Hi,
Goto VBA in OL (Alt+F11) and Insert->Module to add a new module then copy & paste the following code into this new module:
'----Code Start----
Sub SetCategory()
Dim olMail As MailItem
If Application.ActiveExplorer.Selection.Count = 1 And _
Application.ActiveExplorer.Selection.Item(1).Class = 43 Then
Set olMail = Application.ActiveExplorer.Selection.Item(1)
olMail.Categories = "MyCategory"
olMail.Save
End If
Set olMail = Nothing
End Sub
'----Code End----
Return Outlook and select an email message in the folder and then point to Tools->Macro->Macros then select SetCategory macro and click Run.
Now you can change this sub procedure to run with a parameter:
'----Code Start----
Sub SetCategory(catStr as string)
Dim olMail As MailItem
If Application.ActiveExplorer.Selection.Count = 1 And _
Application.ActiveExplorer.Selection.Item(1).Class = 43 Then
Set olMail = Application.ActiveExplorer.Selection.Item(1)
olMail.Categories = catStr
olMail.Save
End If
Set olMail = Nothing
End Sub
'----Code End----
And call from another sub like below:
Call SetCategory("MyCategory"
I hope it helps.
Suat
Oz