10-28-2018, 09:21 PM
Hi Ken,
I based this code on this snippet from: http://www.freevbcode.com/ShowCode.asp?ID=1469
Macro GetUnreadMessagesInInboxVBA
Hopefully this works for you - I used the TypeLibrary Search to get the declaration.
S
I based this code on this snippet from: http://www.freevbcode.com/ShowCode.asp?ID=1469
Macro GetUnreadMessagesInInboxVBA
typelib Outlook {00062FFF-0000-0000-C000-000000000046} 9
Outlook.Application oOutlook._getactive
Outlook.NameSpace oNS
Outlook.MAPIFolder oFldr
oNS = oOutlook.GetNamespace("MAPI")
oFldr = oNS.GetDefaultFolder(olFolderInbox)
;;;;MAPIFolder GetDefaultFolder(FolderType) ;;FolderType: olFolderDeletedItems olFolderOutbox olFolderSentMail olFolderInbox olFolderCalendar olFolderContacts olFolderJournal olFolderNotes olFolderTasks olFolderDrafts olPublicFoldersAllPublicFolders olFolderConflicts olFolderSyncIssues olFolderLocalFailures olFolderServerFailures olFolderJunk olFolderRssFeeds olFolderToDo olFolderManagedEmail olFolderSuggestedContacts
int UnreadMessagesInInbox = oFldr.UnReadItemCount
mes F"UnreadMessagesInInbox = {UnreadMessagesInInbox}"
S