Skip to content

Run External Macros Action: runExternalMacros

The runExternalMacros action executes a macro function from an external macro file in an Excel workbook. This function is handy for automating complex tasks and workflows that rely on pre-written macros.

Note: Ensure that the file being used is not open during the Case execution to avoid errors or conflicts.

Example: You have an Excel file named salesReport.xlsx, a macro file macros.bas, and a macro function FormatReport that needs to be executed.

Steps to Configure:

  1. Add a new step.
  2. Select Set a Variable Value from the Action dropdown.
  3. Enter a variable name in the Element Key field (e.g., MacroExecutionStatus). This variable will store the operation result (e.g., success or failure).
  4. Click on Form, select Functions, and choose EXCEL Handler Functions from the dropdown.
  5. In the Cmd field, select runExternalMacros and provide the following parameters:
    • FPath: Specify the path to the Excel file where the macro will run (e.g., C:\Data\salesReport.xlsx).
    • MacroFile: Specify the path to the external macro file (e.g., C:\Macros\macros.bas).
    • MacroFunction: Specify the macro function name to execute (e.g., FormatReport).
  6. Click Save.
Tabular View
Card View

Outcome on Execution:

  • The action executes the specified macro function from the external macro file in the given Excel workbook.
  • If the operation is successful, the action returns true in the variable defined in the Element Key (e.g., MacroExecutionStatus).
  • If the operation fails (e.g., file not found, invalid macro function, or execution errors), it returns false.
  • This variable can be referenced in later steps of your automation process using the syntax ${VariableName} (e.g., ${MacroExecutionStatus}).

Back To Top