I found that in my mailbox there were some items that were not mail items causing the script to stop. This small change allowed the script to continue to work if something like a meeting request was found:
Sub getmail() Dim olApp As Outlook.Application Dim objNS As Outlook.Namespace Dim olFolder As Outlook.MAPIFolder 'Dim msg As Outlook.MailItem Dim InboxItem As Object Set olApp = Outlook.Application Set objNS = olApp.GetNamespace("MAPI") Set olFolder = objNS.GetDefaultFolder(olFolderInbox) Set olFolder = olFolder.Folders("temp") For Each InboxItem In olFolder.Items Debug.Print InboxItem.Subject Debug.Print InboxItem.EntryID Next End Sub
Thanks for your reply! helped me a lot!
(My apologies - I wanted to comment, but not enough rap.)
source share