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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a Pause for User Action during a Macro 1

Status
Not open for further replies.

noHandlebars

Technical User
Jun 25, 2008
46
US
Is there a way to "pause" a macro to allow the user to delete rows from a table then allow the macro to continue. There need to be multiple pauses during the running of the macro. Any help is appreciated.
 
I do not know if you can stop a macro like that.
Why not have several separate macros
Run macro 1, end with message "Delete rows"
User deletes rows, and runs macro 2. Macro 2 ends with message "delete rows"

And so on?

 
Well, one way is to write a macro for each segment and then use an ontime call to the next segment:

Code:
 Application.Ontime Now + TimeValue("00:00:20"),"NextMacro"

the example gives the user 20 seconds to complete the action and then starts the macro you specify.

However, I wouldn't use this. Instead I'd show them a modeless userform with a description of the action they need to take and a 'continue' commandbutton, that will run the next part of your code.

Cheers,

Roel
 
i used the given example code above and it works fine, but i was wondering if there was a way to have the user enter a keystroke to get to the next macro instead of having it on time delay?
Heres my code:
...
Sub findA12()
Selection.Find.ClearFormatting
With Selection.Find
.Text = "A12"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute

Application.OnTime Now + TimeValue("00:00:05"), "findA27"


End Sub
...
and then it goes to the next macro


any suggestions?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top