Find/Replace Hilite Color

E

Evan Weiner

Is it possible to do a Find/Replace on a hilite color? An author has chosen
a color and obliteratedt the content.
 
S

Stefan Blom

Although you can use find & replace to locate highlighting, you cannot replace the actual color, as far as I know. To do the latter, you'd have to use a macro.

On the other hand, if you just want to clear all highlighting, select the whole document and apply No Color for highlighting.
 
G

Graham Mayor

The foillowing macro will chzange all highlighting in the document or
whatever colour to yellow. If you would prefer a different colour then
change the line
rDcm.HighlightColorIndex = wdYellow

Sub ChangeHiLight()
Dim FirstFind As Boolean
Dim rDcm As Range
Dim lClr As Long ' color index
Dim sCol As String
If ActiveDocument.Content.HighlightColorIndex <> 0 Then
For lClr = 1 To 16
Select Case lClr
Case 1
sCol = "Black"
Case 2
sCol = "Blue"
Case 3
sCol = "Turquoise"
Case 4
sCol = "Bright green"
Case 5
sCol = "Pink"
Case 6
sCol = "Red"
Case 7
sCol = "Yellow"
Case 8
sCol = "White"
Case 9
sCol = "Dark blue"
Case 10
sCol = "Teal"
Case 11
sCol = "Green"
Case 12
sCol = "Violet"
Case 13
sCol = "Dark red"
Case 14
sCol = "Dark yellow"
Case 15
sCol = "50% gray"
Case 16
sCol = "25% gray"
End Select
Set rDcm = ActiveDocument.Range
With rDcm.Find
.Highlight = True
While .Execute
If rDcm.HighlightColorIndex = lClr Then
rDcm.HighlightColorIndex = wdYellow
End If
Wend
End With
Next
Else
MsgBox "No Highlighting found."
End If
End Sub

http://www.gmayor.com/installing_macro.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top