dillon65
04-10-2005, 04:23 PM
Private Sub CountInboxMessages()
'This procedure displays a message box that indicates the number of
'messages currently in the Inbox.
Dim objOutlook As Outlook.Application
Dim objNamespace As Outlook.NameSpace
Dim objMAPIFolder As Outlook.MAPIFolder
Set objOutlook = New Outlook.Application
Set objNamespace = objOutlook.GetNamespace(Type:="MAPI")
Set objMAPIFolder = objNamespace.GetDefaultFolder(olFolderInbox)
MsgBox "You have " & objMAPIFolder.Items.Count & _
" messages in your Inbox.", vbInformation
Set objMAPIFolder = Nothing
Set objNamespace = Nothing
Set objOutlook = Nothing
End Sub
Concerning the above, why does this script not run automatically? I use Outlook XP version, and when I receive my emails, the inbox states, how many unread emails I have. Would this script tell me how many emails in total, from the inbox folder?
Thanks
dillon
'This procedure displays a message box that indicates the number of
'messages currently in the Inbox.
Dim objOutlook As Outlook.Application
Dim objNamespace As Outlook.NameSpace
Dim objMAPIFolder As Outlook.MAPIFolder
Set objOutlook = New Outlook.Application
Set objNamespace = objOutlook.GetNamespace(Type:="MAPI")
Set objMAPIFolder = objNamespace.GetDefaultFolder(olFolderInbox)
MsgBox "You have " & objMAPIFolder.Items.Count & _
" messages in your Inbox.", vbInformation
Set objMAPIFolder = Nothing
Set objNamespace = Nothing
Set objOutlook = Nothing
End Sub
Concerning the above, why does this script not run automatically? I use Outlook XP version, and when I receive my emails, the inbox states, how many unread emails I have. Would this script tell me how many emails in total, from the inbox folder?
Thanks
dillon