General discussion

  • Creator
    Topic
  • #2092381

    Excel Macros with User Interaction

    Locked

    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

All Comments

  • Author
    Replies
    • #3878787

      Excel Macros with User Interaction

      by awilliams3 ·

      In reply to Excel Macros with User Interaction

      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

      • #3834872

        Excel Macros with User Interaction

        by mike i. ·

        In reply to Excel Macros with User Interaction

        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.

    • #3834871

      Excel Macros with User Interaction

      by mike i. ·

      In reply to Excel Macros with User Interaction

      This question was closed by the author

Viewing 1 reply thread