Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.newusers
Jeff Mills
 
Posts: n/a
Default How to repeat a Macro multiple times?

I get a document from a client for publishing every month that's often 30+
pages long, and includes two tabbed columns (a dollar amount field and and a
date field) for a long list of donations that I have to globally delete.
I've created a macro that searches for a TAB then goes to the end of the
line and DELETES everything selected. Beautiful.

How, though, do I instruct Word to now perform that Macro seven or eight
HUNDRED times so that it captures and deletes ALL such instances?

I used to use a word processor (no longer supported) that you could instruct
to perform a macro (or any operation) a certain number of times; I'd enter
700, hit the keystroke for the macro, and away it would go, performing the
macro 700 times. There does not seem to be such an option in Word.

I'm using Word for Mac 11.2, but the concept should apply to any recent
version of Word.

Can you help?

THANK YOU!

  #2   Report Post  
Posted to microsoft.public.word.newusers
Ed
 
Posts: n/a
Default How to repeat a Macro multiple times?

You should be able to add something like:
Dim strCount As String
Dim lngCount As Long
Dim lngCycle As Long
strCount = InputBox("How many times to repeat?")
lngCount = strCount

For lngCycle = 1 To lngCount
' Your Code Here
Next lngCycle

HTH
Ed

"Jeff Mills" wrote in message
...
I get a document from a client for publishing every month that's often 30+
pages long, and includes two tabbed columns (a dollar amount field and and
a
date field) for a long list of donations that I have to globally delete.
I've created a macro that searches for a TAB then goes to the end of the
line and DELETES everything selected. Beautiful.

How, though, do I instruct Word to now perform that Macro seven or eight
HUNDRED times so that it captures and deletes ALL such instances?

I used to use a word processor (no longer supported) that you could
instruct
to perform a macro (or any operation) a certain number of times; I'd enter
700, hit the keystroke for the macro, and away it would go, performing the
macro 700 times. There does not seem to be such an option in Word.

I'm using Word for Mac 11.2, but the concept should apply to any recent
version of Word.

Can you help?

THANK YOU!



  #3   Report Post  
Posted to microsoft.public.word.newusers
Doug Robbins - Word MVP
 
Posts: n/a
Default How to repeat a Macro multiple times?

The following will probably do what you want:

Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(FindText:="^t", 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

"Jeff Mills" wrote in message
...
I get a document from a client for publishing every month that's often 30+
pages long, and includes two tabbed columns (a dollar amount field and and
a
date field) for a long list of donations that I have to globally delete.
I've created a macro that searches for a TAB then goes to the end of the
line and DELETES everything selected. Beautiful.

How, though, do I instruct Word to now perform that Macro seven or eight
HUNDRED times so that it captures and deletes ALL such instances?

I used to use a word processor (no longer supported) that you could
instruct
to perform a macro (or any operation) a certain number of times; I'd enter
700, hit the keystroke for the macro, and away it would go, performing the
macro 700 times. There does not seem to be such an option in Word.

I'm using Word for Mac 11.2, but the concept should apply to any recent
version of Word.

Can you help?

THANK YOU!



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
how do I tell a macro how many times to repeat lee Microsoft Word Help 2 February 16th 06 09:02 PM
Suppressing AutoClose Macro when Creating TOC Spanning Multiple Do Barb R. Tables 2 March 30th 05 03:27 PM
Inputting the same values multiple times in a document... Padster Microsoft Word Help 2 March 15th 05 05:49 PM
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


All times are GMT +1. The time now is 08:56 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"