Find until the end of the document and don't ask if I want to find from beginning of document

C

Céline Brien

Hi everebody,
When you use a macro to find from the beginning to the end of a document
(with a loop), and when you reach the end of the document, how do you tell
Word NOT to ask if I want to find from beginning of the document ?
Many thanks,
Céline

With Selection.Find
.Text = "xxx"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
End With
While Selection.Find.Execute
Selection.MoveLeft Unit:=wdCell
Selection.MoveDown Unit:=wdLine, Count:=2, Extend:=wdExtend
Selection.Rows.Delete
Wend
 
S

StevenM

To: Céline Brien,

You need either:

..Wrap = wdFindContinue

or

..Wrap = wdFindStop

wdFindAsk = After searching the selection or range, Word displays a message
asking whether to search the remainder of the document.

wdFindContinue = The find operation continues when the beginning or end of
the search range is reached.

WdFindStop = The find operation ends when the beginning or end of the search
range is reached.

Steven Craig Miller
 
C

Céline Brien

Hi everybody,
Hi Steven,
Thank you so much for your answer.
wdFindContinue did the job !
Many thanks again !
Have a very good day,
Céline
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top