Solution to loop giving 23,000 extra pages

E

Ed

I just want to share the solution I came up with to my problem. I was using
a Find to locate a string of text, then trying to loop through a series of
actions (one of which was add a page break) once the text string was found.
I started my loop with:

Do While .Execute(FindText:="ITEM ID") = True



The loop, though, found the first instance of the text and sat there,
performing actions and adding pages. Looking at it, I decided it was
finding the text, making FindText = True, but never re-running the Find,
since the Find was outside the loop. I changed to this:

Do

Selection.Find.Execute

If Selection.Find.Found = True Then

' do stuff



which put my Execute as part of the loop, *then* tested for True. It now
works okay.



Thanks to all for the help you gave that led me here.



Ed
 

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