F
Frank
I try to make a simple macro that repeatedly search an active document and
make some editing each time the search success.
How do I make the repeat loop?
The macro looks like this:
Selection.HomeKey Unit:=wdStory
While Not <end of document>
Selection.Find.ClearFormatting
With Selection.Find
.Text = "No table output."
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.TypeBackspace
Selection.MoveUp Unit:=wdLine, Count:=2, Extend:=wdExtend
Selection.TypeBackspace
Selection.MoveUp Unit:=wdLine, Count:=1, Extend:=wdExtend
If Selection.Text <> "" Then Selection.TypeBackspace
Selection.TypeBackspace
Wend
Selection.HomeKey Unit:=wdStory
End Sub
Thanks, Frank
make some editing each time the search success.
How do I make the repeat loop?
The macro looks like this:
Selection.HomeKey Unit:=wdStory
While Not <end of document>
Selection.Find.ClearFormatting
With Selection.Find
.Text = "No table output."
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.TypeBackspace
Selection.MoveUp Unit:=wdLine, Count:=2, Extend:=wdExtend
Selection.TypeBackspace
Selection.MoveUp Unit:=wdLine, Count:=1, Extend:=wdExtend
If Selection.Text <> "" Then Selection.TypeBackspace
Selection.TypeBackspace
Wend
Selection.HomeKey Unit:=wdStory
End Sub
Thanks, Frank