![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
Not every item in your Inbox is necessarily a MailItem. Declare MyMail as Object and throw in an On Error Resume Next statement.
-- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Greg" wrote in message ... I am working on a program to get the attachments from items in my inbox. I know that there are 501 items in my inbox. However, after looking at the 316th item, I get a type mismatch at the "Next MyMail" line. Can anyone shed any light on this? Here is my code to recreate the error. Is there any other type of item other than a MailItem that is in the 501 count that could be causing the problem? Private Sub GetAttachments() Dim OL As Outlook.Application Dim OLNS As Outlook.NameSpace Dim InBox As Outlook.MAPIFolder Dim MyMail As MailItem Dim MyAttachment As Attachment Dim numAttachments As Integer Dim numItems As Integer Set OL = New Outlook.Application Set OLNS = OL.GetNamespace("MAPI") Set InBox = OLNS.GetDefaultFolder(olFolderInbox) numItems = 0 numAttachments = 1 MsgBox InBox.Items.Count & " items in inbox" For Each MyMail In InBox.Items numItems = numItems + 1 txtData.Text = txtData.Text & vbCrLf & numItems txtData.SelStart = Len(txtData.Text) Next MyMail Set OL = Nothing Set OLNS = Nothing Set InBox = Nothing Set MyMail = Nothing Set MyAttachment = Nothing ' Unload Me End Sub Thanks. Greg |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
how do I keep items in the inbox when rule is applied | cscoby | Outlook - Installation | 1 | October 25th 06 09:53 PM |
Merge Inbox and Sent Items into one folder? | Will Richards | Outlook - Installation | 1 | August 17th 06 05:06 PM |
Outlook: inbox and sent items in one folder | vamail | Outlook - General Queries | 1 | April 4th 06 05:10 AM |
No. of Items in Inbox | Steve T | Outlook - General Queries | 3 | March 9th 06 09:23 PM |
Inbox, Sent Items & Outbox in Deleted Items in Outlook 2003 & OWA with Exchange | splounx | Outlook - General Queries | 1 | February 17th 06 02:22 AM |