Remove specific highlight color in whole document
HI friend,
I have the below code to undo/remove highlight, but this will remove at one location.
can any one modify the code to removed specific highlighted color in entire document.
Sub SearchAnyHighlight()
Dim hiliRng As Range
Set hiliRng = ActiveDocument.Content
With hiliRng.Find
.Highlight = True
.Execute
If hiliRng.Find.Found Then
MsgBox "You can't close Active Document"
Do While hiliRng.Find.Execute
If hiliRng.HighlightColorIndex = wdBrightGreen Then
hiliRng.HighlightColorIndex = wdNoHighlight
End If
Loop
End If
End With
End Sub
Leaves first word highlighted
Apologies for resurrecting a 6 year old thread, but it is directly relevant to using this code...
This code works very well for removing a specific color of highlighting except for one catch - if the very first word of the document is highlighted in the specified color, that highlighting remains after the remainder of the highlights are removed. What should be adjusted to include the first word int he removals?