Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub hl01()
- Dim Word As Range
- Dim WordCollection(1) As String
- Dim Words As Variant
- Dim StoryRange As Range
- WordCollection(0) = "active"
- WordCollection(1) = "door"
- For Each StoryRange In ActiveDocument.StoryRanges
- StoryRange.HighlightColorIndex = wdNoHighlight
- Next StoryRange
- Options.DefaultHighlightColorIndex = wdYellow
- Selection.Find.ClearFormatting
- Selection.Find.Replacement.ClearFormatting
- Selection.Find.Replacement.Highlight = True
- For Each Word In ActiveDocument.Words
- For Each Words In WordCollection
- With Selection.Find
- .Text = Words
- .Replacement.Text = ""
- .Forward = True
- .Wrap = wdFindContinue
- .Format = True
- .MatchCase = False
- .MatchWholeWord = False
- .MatchWildcards = False
- .MatchSoundsLike = False
- .MatchAllWordForms = False
- End With
- Selection.Find.Execute Replace:=wdReplaceAll
- Next
- Next
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement