Give this a try:
Make sure to set a reference to the MS Outlook object library, then
declare the following:
Code:
Private colApp As Outlook.Application 'withevents is allowed
Private colNameSpace As Outlook.NameSpace
Private colFolders As Outlook.MAPIFolder
And this sub should find the inbox's item count:
Code:
Private Sub GetInboxTotal()
Set colApp = CreateObject("Outlook.Application")
Set colNameSpace = colApp.GetNamespace("MAPI")
Set colFolders = colNameSpace.GetDefaultFolder(olFolderInbox)
InboxTotal = colFolders.Items.Count
Set colFolders = Nothing
Set colNameSpace = Nothing
colApp.Quit
Set colApp = Nothing
End Sub