How to Batch Remove a Specific Color Category from All Members of an Outlook Contact Group

If you want to remove a specific color category from the contacts responding to all the members of a contact group, you can use the method introduced in this article.

Perhaps you have just created a new contact group from the contacts in a specific color category. Afterwards, you may think that this category is no longer needful. In this case, you may want to quickly remove the specific color category from the contacts corresponding to the group members. Here is a rapid method to realize it.

Batch Remove a Specific Color Category from All Members of an Outlook Contact Group

Remove a Specific Color Category from All Members of a Contact Group

  1. At the very outset, start your Outlook application.
  2. Then, open Outlook VBA editor via pressing “Alt + F11” key buttons.
  3. Next, in the new screen, copy and paste the VBA code below into an unused module.
Sub RemoveSpecificColorCategoryFromAllMembersOfContactGroup()
    Dim objContactGroup As Outlook.DistListItem
    Dim objCurrentFolder As Outlook.Folder
    Dim objCurrentFolderContacts As Outlook.Items
    Dim objDefaultFolderContacts As Outlook.Items
    Dim strCategory As String
    Dim n As Long
    Dim objMemeber As Object
    Dim strFilter As String
    Dim objFoundContact As Outlook.ContactItem
 
    'Get a selected contact group
    Set objContactGroup = Outlook.ActiveExplorer.Selection.Item(1)
 
    If Not (objContactGroup Is Nothing) Then
       strCategory = InputBox("Enter the specific color category:")
 
       If Trim(strCategory) <> "" Then
          Set objCurrentFolder = objContactGroup.Parent
          Set objCurrentFolderContacts = objCurrentFolder.Items.Restrict("[Email1Address]>''")
          Set objDefaultFolderContacts = Application.Session.GetDefaultFolder(olFolderContacts).Items.Restrict("[Email1Address]>''")
 
          'Find the contacts corresponding to the group members
          For n = 1 To objContactGroup.MemberCount
              Set objMember = objContactGroup.GetMember(n)
 
              strFilter = "[Email1Address] = '" & objMember.Address & "'"
              Set objFoundContact = objCurrentFolderContacts.Find(strFilter)
 
              If objFoundContact Is Nothing Then
                 Set objFoundContact = objDefaultFolderContacts.Find(strFilter)
              End If
 
              If Not (objFoundContact Is Nothing) Then
                 'Remove the specific color category
                 Call RemoveCategory(objFoundContact, strCategory)
                 objFoundContact.Save
              End If
         Next
       End If
    End If
End Sub

Sub RemoveCategory(ByVal objCurrentItem As Object, ByRef strSpecificCategory As String)
    Dim varCategories As Variant
    Dim i As Long
 
    varCategories = Split(objCurrentItem.Categories, ",")
    
    If UBound(varCategories) >= 0 Then
       For i = 0 To UBound(varCategories)
           If Trim(varCategories(i)) = strSpecificCategory Then
              varCategories(i) = ""
              objCurrentItem.Categories = Join(varCategories, ",")
              Exit Sub
           End If
       Next
    End If
End Sub

VBA Code - Remove a Specific Color Category from All Members of a Contact Group

  1. After that, you ought to add this macro to Quick Access Toolbar, which you can refer to the article – “How to Run VBA Code in Your Outlook“.
  2. Eventually, you can try this macro.
  • Firstly, select a source contact group. Here is my sample contact group.Group Members
  • Subsequently, click the macro in Quick Access Toolbar.Run Macro on Selected Contact Group
  • Later, you will be required to specify a color category in the popup dialog box.Specify a Color Category
  • After clicking “OK”, macro will continue to work.
  • When it finishes, the specific color category has been removed from the corresponding contacts of the group members, like the following image.Removed Color Category from Group Members

Deal with Miscellaneous Outlook Troubles

It is common for users to encounter diverse issues when working in Outlook. To be honest, it is difficult and even impossible to predict when problems will occur to Outlook. Hence, it’s recommended to back up your Outlook data regularly. Plus, you are better off keeping a remarkable repair tool in vicinity, like DataNumen Outlook Repair. It can fix PST issues without breaking a sweat.

Author Introduction:

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