repeat MS - Word Macro until end of document

M

mirko.pavlovski

Hello 2 All!
I recorded a macro which does some search & replace to a whole
paragraph in a MS Word document.
Does anyone know how can I make that macro to repeat itself untill end
of line i.e. end of the word document.

The logic would be:

While not eof
do
execute macro
move 2 the next line/block od the word document
end while

Thanks.
Regards,
 
D

Doug Robbins

This is an example:

Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(FindText:="MacWordNew", MatchWildcards:=False,
Wrap:=wdFindContinue, Forward:=True) = True
Selection.Paragraphs(1).Range.Delete
Loop
End With

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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