Link to home
Start Free TrialLog in
Avatar of newbie46
newbie46

asked on

How do I retrieve the color flag of an Outlook email using Access 2007 vba?

I am using the following code to read emails from Outlook:

Private Sub ImportEmails_Click()
Dim olApp As Outlook.Application
Dim Inbox As Outlook.MAPIFolder
Dim mItem As MailItem
Dim InboxItems As Outlook.Items

On Error GoTo Err_ImportEmails_Click

Set olApp = CreateObject("Outlook.Application")

Set Inbox = olApp.GetNamespace("Mapi").GetDefaultFolder(olFolderInbox).Folders("xxx").Folders("yyy")

Set InboxItems = Inbox.Items
 
For Each mItem In InboxItems

'Check email flag
'If Flag = Yellow then
'EmailAssignedTo="Sue"
'elseif Flag = Red then
'EmailAssignedTo = "Bob"
'end if
.
Next

I need to add code which will determine the color of the email flag, to incorporate the if statements above, which are commented out.

How is the color of the email flag accessed?
I have found information on using OlCategoryColor, but have not been able to successfully incorporate this into the code.
ASKER CERTIFIED SOLUTION
Avatar of Chris Bottomley
Chris Bottomley
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of newbie46
newbie46

ASKER

Chris,
Thanks for your response. FlagIcon is not an option in the dropdown displayed after typing mitem. Do I need to access FlagIcon through another avenue?

I have attached a screen shot of the options that are visible from mitem.
mItemOptions.doc
Chris,
I was able to solve the problem using mItem.Categories to access the name associated with the color coded email, so I didn't have to bother with the color.
Thanks.