views:

328

answers:

1

Okay, i've got an Outlook 2003 VBA macro that clears a mail item's categories, and this is assigned to a button. However, i've got a conditional formatting rule that's already been applied, so when (in the inbox list view) i run the macro, the categories are cleared but the conditional formatting on that item remains until i select a different item.

How would i, in the macro, force the conditional formatting rules to be cleared (or reapplied)? I.e. unformat that message.

For reference, the code looks like this (and if there's a better approach, please explain):

Sub ClearCategories()
Dim msg As Outlook.MailItem
Select Case TypeName(Outlook.Application.ActiveWindow)
  Case "Explorer"
    Set msg = Outlook.Application.ActiveExplorer.Selection.Item(1)
  Case "Inspector"
    Set msg = Outlook.Application.ActiveInspector.CurrentItem
End Select
msg.Categories = ""
Set msg = Nothing
End Sub
+1  A: 

Figured it out. Need to save and close the item after the category change.

msg.Close(olSave)
bill weaver