unread outlook emails

azolfaghari

New member
Local time
Yesterday, 20:41
Joined
Jul 24, 2014
Messages
8
Hi there,
I need to write a vba code that tells me number of unread and incoming emails in an inbox in outlook. I managed to link to inbox in outlook, but all I need now is to write the code to give me:
a) number of unread emails
b) fill some of unread emails details (like name, from) in a listbox

any help will be appreciated.
Thanks
Arvin
 
To check a mailbox:

Dim olApp As New Outlook.Application
Dim olIn, olMap As Outlook.Folder
Set olApp = Outlook.Application
Set MAPISpace = olApp.GetNamespace("MAPI")
Set olIn = MAPISpace.GetDefaultFolder(olFolderInbox)
Set olMap = olIn.Folders("YourOwnFolder")
msgbox olMap.Items.Count

To get items in the mailbox.....

For Each olMail In olMap.Items
msgbox olMail.HTMLBody
next olMail
 

Users who are viewing this thread

Back
Top Bottom