2 Useful Methods to Replace Highlight Color in Your Word Document

In this article, we are delighted to show you 2 useful methods to replace the highlight color in your Word document.

Sometimes you may highlight different contents with different colors. But unlike font color, you cannot utilize the “Find and Replace” to find texts in a specific highlight color and replace it with another one.

Therefore, we are going to need some workarounds. Following are 2 ways available for different cases.Replace Highlight Color in Your Word Document

Method 1: Replace All Highlight Colors with the Same One

The highlight color associated to “Find and Replace” dialog box is the current one selected in the Highlight icon.

  1. First of all, under “Home” tab and in “Font” group, click on the drop-down button on “Text Highlight Color” command. Pick a color to which you want change all highlight colors. For example, we choose “Bright Green” here.Click "Home"->Click Drop-down Button on "Text Highlight Color" Command->Choose a Color
  2. Then press “Ctrl+ H” to trigger the “Find and Replace” dialog box.
  3. Put cursor inside “Find what” text box.
  4. Click “More” to bring out more options and click “Format”.
  5. And choose “Highlight”.Click "Format"->Click "Highlight"
  6. Next put cursor inside “Replace with” box and repeat step 4 and 5.
  7. Lastly, click “Replace All”.Click "Replace All"

Now you have replaced all highlight colors with the bright green.

Method 2: Replace a Specific Highlight Color with Another

To accomplish this task, a macro is required.

  1. First and foremost, press “Alt+ F11” to open VBA editor.
  2. Next click “Normal” project on the left column.
  3. Then click “Insert” tab on the menu bar.
  4. And choose “Module” on that drop-down menu.Click "Normal"->Click "Insert"->Click "Module"
  5. Open the new module by double click.
  6. Now paste following codes:
Sub ReplaceOneHighlightColorToAnother()
  Dim strFindColor As String
  Dim strReplaceColor As String
  Dim objDoc As Document
  Dim objRange As Range
 
  Application.ScreenUpdating = False
 
  Set objDoc = ActiveDocument
 
  strFindColor = InputBox("Specify a color (enter the value):", "Specify Highlight Color")
  strReplaceColor = InputBox("Specify a new color (enter the value):", "New Highlight Color")
 
  With Selection
    .HomeKey Unit:=wdStory
    With Selection.Find
      .Highlight = True
 
      Do While .Execute
        If Selection.Range.HighlightColorIndex = strFindColor Then
          Set objRange = Selection.Range
          objRange.HighlightColorIndex = strReplaceColor
          Selection.Collapse wdCollapseEnd
        End If
      Loop
    End With
  End With
 
  Application.ScreenUpdating = True
End Sub
  1. Next click “Run” button or hit “F5”.Paste Codes->Click "Run"
  2. Then in the “Specify Highlight Color” box, enter a value represent the color to be replaced. To get the corresponding value of a specific color, you can visit this link: https://msdn.microsoft.com/VBA/Word-VBA/articles/wdcolorindex-enumeration-wordColor Values
  3. For instance, if we want to replace the yellow color with bright green, we enter “7” in “Specify Highlight Color” box and click “OK”.Enter a Value->Click "OK"
  4. Then in “New Highlight Color” box, enter a value of the new color and click “OK”.

Here is the possible outcome of replacing yellow with bright green.Result of Changing Yellow Color to Bright Green

Avoid Data Loss Disaster

Word is such a great helper in our daily work. Therefore, it’s not hard to imagine the catastrophe it can bring when it collapses. To avoid losing critical data, you can get hold of a Word fix tool in advance. With such a utility at hand, you should not need to worry about the data loss.

Author Introduction:

Vera Chen is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including corrupt xlsx and pdf repair software products. For more information visit www.datanumen.com