Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to loop MSWORD macro until end of document?

Status
Not open for further replies.

Chavito1983

Technical User
Aug 12, 2008
10
NL
Hi all,

I'm a vb amateur so please bear with me ;)...

Who can help me find a way to loop something until the end of a Word document? I just can't get it to stop.

Primarily, I am trying to loop (or better, alternate) two macros from the insertion point until the end of the document. If possible and easy to do, I would like to also have the option to select some text and run the macros on the selected text instead of the remainder of the document.

The following works. The problem is that there is no way of telling how many times the macros are going to run before the end, so counters are not an option. Each macro grabs a portion of text based on its contents and processes it. The insertion point then moves past the processed section.

Code:
Sub GetFuzzies()

Do

Application.Run MacroName:="macro1"
    Application.Run MacroName:="macro2"
   
Loop
End Sub

Thanks a lot for any help!

Chavo
 




Please post macro and VBA questions in Forum707.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top