Use this code to remove all categories and set the category to "Completed" when a Task is marked Complete.
You need to use two (or more) If statements with this code. If you check just for Complete = True, it will run forever. In this code sample, I'm checking the Category for "Completed" (and skipping Recurring tasks). If the category is not marked Completed, the code removes all categories and sets the Category to Completed. It saves and then opens the task.
This macro needs to go into ThisOutlookSession. To test the macro, click in Initialize_handler then click the Run button.
See How to use the VBA Editor if you don't know how to use macros.
Public WithEvents OlItems As Outlook.Items
Public Sub Initialize_handler()
Set OlItems = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderTasks).Items
End Sub
Private Sub OlItems_ItemChange(ByVal Item As Object)
If Item.Complete = True And Item.IsRecurring = False Then
If InStr(1, Item.Categories, "Completed") = False Then
With Item
.Categories = ""
.Categories = "Completed"
.Save
.Display
End With
End If
End If
End Sub
More Information
Create a Task when a message is flagged
Task: Categorize a completed task. (Michael Bauer, VBOffice.net)

