Setting categories using optional VBA does not work in Outlook 2007

I am trying to set email categories for the current selection. When I run the macro, I get only one message specified by this category. I use the following code (and also tried to use do until ... not using selection.count):

Sub SetSelectionComplete()
    Dim mailMsg As MailItem

    For Each mailMsg In Outlook.Application.ActiveExplorer.Selection
        mailMsg.Categories = "Complete"
    Next

End Sub

Any ideas?

+5
source share
2 answers

Save the mailMsg element every time, for example:

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

Janko You need to call Mailitem.Save. As Remu says, working with selection works well in the opposite direction. Marcus

0
source

All Articles