How to Auto Set the Same Color Category to All Mails in the Same Conversation in Outlook

If you want to set the same color category to all emails in the same conversation, you can utilize the piece of VBA code introduced in this article to realize it.

In order to better classify and manage emails, you may be used to applying color categories. In addition, if you have many conversations, namely email threads in your Outlook, so as to better identify the emails in one conversation, you may like to apply the same color categories to all the mails in the same conversation. With no doubt, manually setting the color category to an email thread is pretty tedious. Therefore, why don’t you let Outlook auto assign the same color category to the rest when categorizing an email in a conversation? You can make use of the piece of VBA code in the followings to achieve it without breaking a sweat.

Auto Set the Same Color Category to All Mails in the Same Conversation in Outlook

Auto Set the Same Color Category to All Mails in the Same Conversation

  1. At the very outset, you should launch your Outlook application.
  2. Then in main Outlook window, press “Alt + F11” key buttons.
  3. Next you will access Outlook VBA editor window, in which you ought to find and open the “ThisOutlookSession” project.
  4. Subsequently, copy the following VBA code into this project window.
Public WithEvents objExplorer As Outlook.Explorer
Public WithEvents objMail As Outlook.MailItem

Private Sub Application_Startup()
    Set objExplorer = Outlook.Application.ActiveExplorer
End Sub

Private Sub objExplorer_SelectionChange()
    On Error Resume Next
    If objExplorer.Selection.Item(1).Class = olMail Then
       Set objMail = objExplorer.Selection.Item(1)
    End If
End Sub

Private Sub objMail_PropertyChange(ByVal Name As String)
    Dim objConversation As Outlook.Conversation
    Dim objStore As Outlook.Store
    Dim strCategories As String
 
    'When assigning color categories to the currently selected mail
    If Name = "Categories" Then
       strCategories = objMail.Categories
 
       Set objStore = objMail.parent.Store
 
       If objStore.IsConversationEnabled Then
          'Get the conversation
          Set objConversation = objMail.GetConversation
 
          If Not (objConversation Is Nothing) Then
             'Assign the same color categories to the mails in this conversation
             objConversation.SetAlwaysAssignCategories strCategories, objStore
          End If
       End If
    End If
End Sub

VBA Code - Auto Set the Same Color Category to All Mails in the Same Conversation

  1. After that, you should sign this code.
  2. Later, you need to change your Outlook macro security settings to allow the digitally signed macros.
  3. Eventually, you can restart your Outlook application to activate this macro.
  4. From now on, every time when you assign any color category to one mail in a conversation, Outlook will auto assign the same one to the rest emails in this conversation.

Take Care of Your PST File Prudentially

Like Word documents or Excel spreadsheets, PST files are the same vulnerable. Therefore, in order to prevent PST data corruption and avoid difficult PST repair, you’d better keep taking care of your PST file all the time. For instance, you need to beware of your daily handling in Outlook and back up your PST file regularly. In addition, if possible, you can prepare a preeminent tool, such as DataNumen Outlook Repair in advance.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including mdf repair and outlook repair software products. For more information visit www.datanumen.com

Leave a Reply

Your email address will not be published. Required fields are marked *