Finding loop conditiion

S

Sasa

Im trying to make condition for macro that is searching
for special word through the document. Im not able to make
macro stop searching procedure (it loops as many times as
word is found) and when it reaches the end, it start from
the begining. I want to make stop find procedure when it
reaches the end of document.

Help is appreciated.
Thanks.
Sasa
 
J

Jonathan West

Hi Sasa,

If you are using the Find object for this, then you need to set the Wrap
property of that object to wdFindStop.
 
H

Helmut Weber

Hi Sasa,
what exactly do you want to do.
Could it be you want fo find the last
"special" word in your document?
One very simple way would be:
With Selection
.WholeStory
.Collapse direction:=wdCollapseEnd '!
With .Find
.ClearFormatting
.text = "and"
.Forward = False '!
.MatchWildcards = False
.Execute
End With
End With
Greetings from Bavaria, Germany
Helmut Weber
"red.sys" & chr$(64) & "t-online.de"
Word 97, NT 4.0
 
Top