I wrote a small macros to process all bold pieces of text in the word document. I use break point on the loop statement to see how it goes, the script finds all bold pieces OK but when it comes to the last piece the loop won't stop, it goes forever selecting the last piece over and over again regardless wdFindStop parameter.
Can anyone please tell me how to fix it? thanks.
Sub s()
With Selection.Find
.ClearFormatting
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = True
.Font.Bold = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Do While Selection.Find.Execute
' process information from selection
Loop
End Sub
Can anyone please tell me how to fix it? thanks.
Sub s()
With Selection.Find
.ClearFormatting
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = True
.Font.Bold = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Do While Selection.Find.Execute
' process information from selection
Loop
End Sub