Quote:
Originally Posted by macropod
Hi Sdoneti,
Try something like the following, which shows how you can get the next word, or even the whole paragraph:
Code:
Sub Demo()
With Selection.Range
With .Find
.ClearFormatting
.Text = "Heading"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute
End With
Do While .Find.Found
' get the next word
MsgBox .Words.Last.Next.Words.First
' get the whole paragraph
MsgBox .Paragraphs.Last.Range.Text
.Collapse wdCollapseEnd
.Find.Execute
Loop
End With
End Sub
|
when i'm test is looping forever.
are only happen to me?