Group:  Microsoft Word ยป microsoft.public.word.newusers
Thread: Macro - Repeat Action

Geek News

Macro - Repeat Action
"Jan Groshan" <jangro[ at ]pacbell.net> 12/25/2008 9:01:51 PM
What is the command to repeat a macro in Word 2007? I want to run a macro on
a long list and want the macro to repeat 100+ times.


Re: Macro - Repeat Action
Jay Freedman <jay.freedman[ at ]verizon.net> 12/25/2008 10:02:15 PM
On Thu, 25 Dec 2008 13:01:51 -0800, "Jan Groshan" <jangro[ at ]pacbell.net> wrote:

[Quoted Text]
>What is the command to repeat a macro in Word 2007? I want to run a macro on
>a long list and want the macro to repeat 100+ times.
>

There is no specific command for that.

As an overly simplistic solution, you can write a second macro that calls the
first one in a loop, like

Sub Repeat100()
Dim i As Long
For i = 1 To 100
Call MyMacro
Next i
End Sub

Change "MyMacro" to the name of the macro you want to repeat.

The problem with this is that it always repeats 100 times. If that's too many or
too few, it isn't easy to adjust. A better solution is to modify your original
macro so the loop is inside it, and use a While loop or something of that sort
(instead of the fixed For loop) to stop looping when all the work is done.
Unfortunately, without knowing exactly what your macro does and how it does it,
I can't be any more specific than that.


--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
Re: Macro - Repeat Action
"Jan Groshan" <jangro[ at ]pacbell.net> 12/25/2008 11:54:30 PM
THANKS !


"Jay Freedman" <jay.freedman[ at ]verizon.net> wrote in message
news:ab08l4d963se9t1tfmfjhl7v2ml32aots6[ at ]4ax.com...
[Quoted Text]
> On Thu, 25 Dec 2008 13:01:51 -0800, "Jan Groshan" <jangro[ at ]pacbell.net>
> wrote:
>
>>What is the command to repeat a macro in Word 2007? I want to run a macro
>>on
>>a long list and want the macro to repeat 100+ times.
>>
>
> There is no specific command for that.
>
> As an overly simplistic solution, you can write a second macro that calls
> the
> first one in a loop, like
>
> Sub Repeat100()
> Dim i As Long
> For i = 1 To 100
> Call MyMacro
> Next i
> End Sub
>
> Change "MyMacro" to the name of the macro you want to repeat.
>
> The problem with this is that it always repeats 100 times. If that's too
> many or
> too few, it isn't easy to adjust. A better solution is to modify your
> original
> macro so the loop is inside it, and use a While loop or something of that
> sort
> (instead of the fixed For loop) to stop looping when all the work is done.
> Unfortunately, without knowing exactly what your macro does and how it
> does it,
> I can't be any more specific than that.
>
>
> --
> Regards,
> Jay Freedman
> Microsoft Word MVP FAQ: http://word.mvps.org
> Email cannot be acknowledged; please post all follow-ups to the newsgroup
> so all may benefit.


Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net