PDA

View Full Version : Using Outlook 2007 email categories in Access



portyal
10-26-2011, 07:09 AM
Hi

I have an Access database which includes code to identify e-mails in Outlook and perform various actions with them. Up to now I've used the Complete flag to identify the e-mail I wish to select:


Dim ns As Outlook.Namespace
Dim sent As Outlook.MAPIFolder
Dim temp As Outlook.MAPIFolder
Dim i As Integer
Dim j As Integer
Dim email As MailItem
Dim att As Attachment
Dim emailname As String

Set ns = GetNamespace("MAPI")

' Temp is a subfolder of Inbox
Set temp = ns.GetDefaultFolder(olFolderInbox)

For i = temp.Items.Count To 1 Step -1

If temp.Items(i).Class <> 43 Then GoTo nexti:

If temp.Items(i).FlagStatus = olFlagComplete Then

(perform required actions)

temp.Items(i).FlagStatus = olNoFlag

(etc.)



I now wish to use the e-mail Category color e.g. yellow, to identify the email I wish to work with. I have found the olCategoryColor property but this does not appear to work in the same way as the FlagStatus property above e.g.


If temp.Items(i).CategoryColor = olCategoryColorYellow Then





returns an Run-time error '438': Object doesn't support this property or method.

I'd therefore be grateful for any help or advice in the use of the olCategoryColor property.

Please bear in mind I'm not an expert in VBA coding :)

Thanks

AL