我在 Word 2007 中录制了一个宏,它找到一个单词,将光标向上移动两行,插入三个“***”,然后突出显示该行。它适用于找到的单词的第一个实例。我正在努力让它在整个文档中重复我希望它找到的单词的所有实例。
这是我录制的宏的输出。我需要为“B”的每个实例重复这些操作。
Sub HighlightNewItems()
'
' HighlightNewItems Macro
'
'
Selection.Find.ClearFormatting
With Selection.Find
.Text = "B,"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.MoveUp Unit:=wdLine, Count:=2
Selection.MoveLeft Unit:=wdWord, Count:=1
Selection.TypeText Text:="***"
Selection.TypeParagraph
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Options.DefaultHighlightColorIndex = wdRed
Selection.Range.HighlightColorIndex = wdRed
Selection.MoveRight Unit:=wdCharacter, Count:=1
End Sub