Setting categories using VBA on a selection does not seem to work in Outlook 2007

outlook, vba

Solution

Save the mailMsg item each time, like this:

Sub SetSelectionComplete()
    Dim mailMsg As MailItem
    For Each mailMsg In Outlook.Application.ActiveExplorer.Selection
        mailMsg.Categories = "Complete"
        mailMsg.Save
    Next
End Sub

Problem

I'm trying to set the mail message categories for the current selection. When I run the macro I end up in only a single message being set to the given categorie. I Use the following code (and have also tried to use a do until..loop using the `selection.count`): ``` Sub SetSelectionComplete() Dim mailMsg As MailItem For Each mailMsg In Outlook.Application.ActiveExplorer.Selection mailMsg.Categories = "Complete" Next End Sub ``` Any ideas?

Original source