none
Visual Basic Outlook 2013 set specific category color RRS feed

  • Question

  • Hello! i need some help with a script.

    Public Sub CategoriesButton()
      Dim Item As Outlook.MailItem
      Set Item = Application.ActiveInspector.CurrentItem
      Item.ShowCategoriesDialog
    End Sub

     

    This script pops upp the category window, this isnt rly what i want and i need some guidelines or links so i can do the following:

    selected mail shall be set to green category when i stand on it and click the macro.

    Any suggestions?

     


    • Edited by Erik at work Wednesday, November 28, 2012 3:30 PM
    Wednesday, November 28, 2012 3:30 PM

Answers

  • first, multiple categories can have the same color, there is no such thing as 'green' category per se, it can have name 'green' but for example has assigned oragne color. So if you want to set soem category on mail, simply set its Categories property. If you do not want to wipeout existing categories, add comma before it, something like:

    mailItem.Categories = mailItem.Categories + ", MyCategoryName";

    Wednesday, November 28, 2012 7:58 PM

All replies

  • first, multiple categories can have the same color, there is no such thing as 'green' category per se, it can have name 'green' but for example has assigned oragne color. So if you want to set soem category on mail, simply set its Categories property. If you do not want to wipeout existing categories, add comma before it, something like:

    mailItem.Categories = mailItem.Categories + ", MyCategoryName";

    Wednesday, November 28, 2012 7:58 PM
  • so the proper code would be like:

    Sub Privat()
    MailItem.Categories = MailItem.Categories + ", Privat"
    End Sub

    i cant seem to get it to work :(

    Monday, February 11, 2013 5:08 PM
  • what exactly does not work? is property not updated? or something else?
    Monday, February 11, 2013 6:31 PM