Hi,
I have written a macro (Word 2000, but I guess it will work in other
versions too) that does some manipulation I want. But it just does it once.
Can anyone tell me what code I need to wrap it in to make it run repeatedly
to the end of the document?
It does a find next for the next string to be processed, so there are no
problems about running it again from where it is at the end of its
execution, by the way.
Thanks
David
Jay Freedman - 30 Jun 2005 02:03 GMT
>Hi,
>
[quoted text clipped - 10 lines]
>
>David
The preferred method is not to repeat the whole macro.
If it's possible to do the job with a ReplaceAll, that will be the
fastest and most efficient way. For example, see
http://word.mvps.org/FAQs/MacrosVBA/FindReplaceAllWithVBA.htm.
If the processing you need to do can't be handled by ReplaceAll, then
set up a loop whose condition is the boolean value returned by the
.Execute method (True if the search was successful, False if there are
no more occurrences). For an example of this, see
http://word.mvps.org/FAQs/MacrosVBA/ReplceTextWithDoc.htm.
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org