Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
lee
 
Posts: n/a
Default how do I tell a macro how many times to repeat

After I've recorded a macro, how do I tell it how many times I want it to
repeat?
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Charles Kenyon
 
Posts: n/a
Default how do I tell a macro how many times to repeat

By coding repetition into your macro. You can't record this, you have to go
into the vba editor and write computer code.
http://word.mvps.org/FAQs/MacrosVBA/...ordedMacro.htm

What is your macro doing? There may be a better tool than a macro.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.


"lee" wrote in message
...
After I've recorded a macro, how do I tell it how many times I want it to
repeat?



  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Greg
 
Posts: n/a
Default how do I tell a macro how many times to repeat

If you want to repeat an entire macro a certain number of time, you
would need to call it that number of time. For example the following
code calls the macro named "CountDown" ten times:

Sub Test()
Dim i As Long
For i = 1 To 10
CountDown i
Next i
MsgBox "We have a liftoff."
End Sub
Sub CountDown(i As Long)
MsgBox "T-" & 11 - i & " seconds and counting."
End Sub

If your macro is performing a specific steps and you want to repeat
that step you would use a similiar construction to repeat the step:

Sub Test()
Dim i As Long
MsgBox "T-10 seconds. We have main motor start."
For i = 1 To 9
MsgBox "T-" & 10 - i
Next i
MsgBox "We have a liftoff."
End Sub

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Repeat a macro? JLeck Microsoft Word Help 2 December 16th 05 06:59 PM
Repeat macro until end of document Chris@PDX Microsoft Word Help 1 July 7th 05 03:57 AM
how do you make a macro execute x number of times? ShelleyC Microsoft Word Help 1 March 14th 05 03:05 PM
Want to Repeat Records certain number of times davis Mailmerge 2 February 16th 05 08:21 PM
2000 to 2002 macro and "Could not open macro storage" Art Farrell Mailmerge 1 December 6th 04 12:40 PM


All times are GMT +1. The time now is 09:53 PM.

Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
Copyright 2004-2023 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"