General discussion

Locked

Excel Macros with User Interaction

By Mike I. ·
I have recorded three macros. to be deployed to various users. My intent is to move the macros into each users Personal.xls and to place three appropriatly linked icons on their toolbars. It occurs to me that there must be away to place all three macros into a single statement, but provide dialogs between each set of actions that would allow the user to bail out or proceed depending upon which is appropriate to their needs.

I'm hoping there is an obvious answer that as a novice I am just missing. Thanks in advance for you input. Mike

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Excel Macros with User Interaction

by awilliams3 In reply to Excel Macros with User In ...

There are multitudes of ways to do what you are asking. Perhaps the most basic way to do so is utilize message boxes between the calls to each routine. Message boxes can display a prompt with a Yes/No question which your code can react to. The sample assumes you have recorded three routines you are trying to call. This routine will prompt you to run each one, if yes continue, no stop. You will get a message box for each routine.

Public Sub Main()
Dim intContinue As Integer intContinue = MsgBox(prompt:="Execute routine1?", Buttons:=vbYesNo)

If intContinue = vbNo Then
Exit Sub
End If

routine1

intContinue = MsgBox(prompt:="Execute routine2?", Buttons:=vbYesNo)

If intContinue = vbNo Then
Exit Sub
End If

routine2

intContinue = MsgBox(prompt:="Execute routine3?", Buttons:=vbYesNo)

If intContinue = vbNo Then
Exit Sub
End If

routine3
End Sub

Public Sub routine1()
MsgBox prompt:="Routine1"
End Sub

Public Sub routine2()
MsgBox prompt:="Routine2"
End Sub

Public Sub routine3()
MsgBox prompt:="Routine3"
End Sub

Collapse -

Excel Macros with User Interaction

by Mike I. In reply to Excel Macros with User In ...

Thanks. I'll tweak the text to give my users a bit more information, but this is exactly what I was wanting to do, provide simple yes/no options.

Collapse -

Excel Macros with User Interaction

by Mike I. In reply to Excel Macros with User In ...

This question was closed by the author

Back to Software Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums