Run macro action

The Run macro action in the Excel advanced package enables you to run macros in a worksheet.

Settings

  • Specify the name of the macro you want to run and its arguments.
  • Enter the name of the session used to open the workbook with the Open action.
Note:
  • When you write a macro code, use Exit Sub to exit or end a specific procedure at any point.
  • Ensure that a macro code contains only one instance of the End or End Sub statement to terminate the macro. If there is more than one instance of the statement, then on execution, the bot might fail with an error.
Consider the following example where you want to get an input box and exit the procedure if a user's reply is not a number:
Sub vba_exit_sub_example()
If IsNumeric(InputBox("Enter your age.", "Age")) = False Then
   MsgBox "Error! Enter a numeric value only."
   Exit Sub
Else
   MsgBox "Thank you."
End If
End Sub