Macro code to add Catergory Colour to Mail.
Hi,
I have 4 existing macros which forward the selected email from the inbox to 1 of 4 pre-set email accounts when run. I would like to include code into these macros that marks the emails in the inbox with a category colour so i can see which items have been forwarded to which 1 of the 4 pre-set email accounts e.g. Blue Category, Red Category, Yellow Category and Green Category. I have played around with objMail.Categories and objMail.Save without any success. I hope somebody can assist. My existing Macro code is:
Sub EmailFoward()
Dim objMail As Outlook.MailItem
Set objItem = GetCurrentItem()
Set objMail = objItem.Forward
objMail.To = "email account"
objMail.Send
Set objItem = Nothing
Set objMail = Nothing
End Sub
Function GetCurrentItem() As Object
Dim objApp As Outlook.Application
Set objApp = Application
On Error Resume Next
Select Case TypeName(objApp.ActiveWindow)
Case "Explorer"
Set GetCurrentItem = _
objApp.ActiveExplorer.Selection.Item(1)
Case "Inspector"
Set GetCurrentItem = _
objApp.ActiveInspector.CurrentItem
Case Else
End Select
End Function
Thanks. (Running Outlook 2007).
Last edited by CamP : October 25th 10 at 08:01 AM.
|