How find and replace specific colour highlights? in Word General Questions  
 |  Edit my Profile  |  Help
 
     
  
 
 
 
Highlight 9/9/2004 11:57 PM PST
  Question
  How do I do a macro that finds all highlights in a praticular colour in a
document and replaces them with highlights of a different colur, or with no
highlight at all?
 
  Was this post helpful to you?  
 
 
  Reply | Print post   TopTop  
 
 
 
 
Helmut Weber 9/10/2004 12:32 AM PST
  Answer
  Hi, just one of some ways:
Sub Test453()
Dim oRng As Range
Set oRng = ActiveDocument.Range
ResetSearch
With oRng.Find
.Text = ""
.Highlight = True
While .Execute
If oRng.HighlightColorIndex = wdYellow Then
oRng.HighlightColorIndex = wdAuto
End If
oRng.Start = oRng.End
oRng.End = ActiveDocument.Range.End
Wend
End With
ResetSearch
End Sub
'---
Private Sub ResetSearch()
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute
End With
End Sub

 
  Was this post helpful to you?  
 
 
  Reply | Print post   TopTop  
 
 
  Return to Microsoft Communities  Notify me of replies