M
Mike
I'm trying to write a macro that will find all instances
of a word and add a comment to it. The code below works,
but only if I highlight all my text with my mouse. What am
I doing wrong?
Thanks!
Sub addComment()
Selection.Find.ClearFormatting
With Selection.Find
.Text = "hello"
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Do While Selection.Find.Execute
Selection.Comments.Add Range:=Selection.Range, _
Text:="This is my comment!"
Loop
End Sub
of a word and add a comment to it. The code below works,
but only if I highlight all my text with my mouse. What am
I doing wrong?
Thanks!
Sub addComment()
Selection.Find.ClearFormatting
With Selection.Find
.Text = "hello"
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Do While Selection.Find.Execute
Selection.Comments.Add Range:=Selection.Range, _
Text:="This is my comment!"
Loop
End Sub