Discussion:
repeat MS - Word Macro until end of document
(too old to reply)
m***@gmail.com
2005-10-17 13:05:53 UTC
Permalink
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,
Doug Robbins
2005-10-17 17:24:18 UTC
Permalink
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
Post by m***@gmail.com
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.
While not eof
do
execute macro
move 2 the next line/block od the word document
end while
Thanks.
Regards,
Loading...