How to Batch Find and Replace Text in All Color Category Names with Outlook VBA

Normally, to find and replace a specific text in all color category names, you have to manually process the categories one by one. But it is too cumbersome. Therefore, this article will teach you a much more efficient way to batch accomplish it.

Maybe you have customized the names of color categories in your Outlook. Now, if you want to find and replace a specific text in the category names, in general, you have to rename the color categories one by one. There is no doubt that that means is too tedious and troublesome. You must long for a far more convenient approach which can let you find and replace text in batch. Thus, thereinafter, we will introduce you such a method.

Batch Find and Replace Specific Text in All Color Category Names

  1. At first, launch Outlook VBA editor with reference to “How to Run VBA Code in Your Outlook“.
  2. Then, in the “Microsoft Visual Basic for Applications” window, copy the VBA code below into an unused module.
Sub FindReplaceTextAllColorCategoriesNames()
    Dim strFind, strReplace As String
    Dim objStores As Outlook.Stores
    Dim i As Long
    Dim objStore As Outlook.Store
    Dim objCategories As Outlook.Categories
    Dim objCategory As Outlook.Category
    Dim lCount As Long
    'Specify the text
    strFind = InputBox("Enter the specific text for find:", , "Category")
    If strFind <> "" Then
       strReplace = InputBox("Enter the specific text for replace:", , "CAT")
       lCount = 0
       'Process all color categories in all mailboxes
       Set objStores = Outlook.Application.Session.Stores
       For i = objStores.Count To 1 Step -1
           Set objStore = objStores.Item(i)
           Set objCategories = objStore.Categories
           For Each objCategory In objCategories
               If InStr(objCategory.Name, strFind) > 0 Then
                  'Replace text
                  objCategory.Name = Replace(objCategory.Name, strFind, strReplace)
                  lCount = lCount + 1
               End If
       'Prompt you of the results
       MsgBox "Complete!", vbInformation + vbOKOnly
    End If
End Sub

VBA Code - Batch Find and Replace Specific Text in All Color Category Names

  1. After that, press “F5” directly to trigger this macro.
  2. Subsequently, you’ll be required to input the specific text for find and replace.Specify Text for Find and Replace
  3. After macro completes, you can check color categories in your Outlook. All of the specific texts have been replaced in the category names.Replaced Text in Color Category Names

Don’t Be Worried in the Event of Outlook Crash

Have you ever encountered Outlook crash? It refers to the problems like Outlook suddenly getting stuck, auto restarting on its own and so on. At the best, nothing bad will happen. However, at the worst, the Outlook file can be compromised. At that point, the inbuilt repair tool will not work. Your only resort is either a potent and reliable PST recovery tool, such as DataNumen Outlook Repair, or specialized recovery services.

Author Introduction:

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

Comments are closed.