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

Posted on 2012-08-23
Medium Priority
Last Modified: 2012-10-06
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
'elseif Flag = Red then
'EmailAssignedTo = "Bob"
'end if

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.
Question by:newbie46
  • 2
LVL 59

Accepted Solution

Chris Bottomley earned 2000 total points
ID: 38327892
via mitem.flagicon

if mitem.FlagIcon = olRedFlagIcon then ...


Author Comment

ID: 38330491
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.

Author Comment

ID: 38330720
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.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I came across an unsolved Outlook issue and here is my solution.
Implementing simple internal controls in the Microsoft Access application.
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question