Skip to main content

Run Excel macro

Sophie avatar
Written by Sophie
Updated over a week ago

Definition and Usage

Run Excel macro command executes a specified macro within an Excel file. This action allows automation of complex Excel operations by triggering VBA macros that have been defined in the workbook.


Parameter Values

Input parameters

Parameter

Description

Possible Values

Required

Options / Notes

Excel instance

Please select an Excel instance to identify the instance to operate on

Previously created Excel instance

Yes

Must be created via the "Launch Excel" or "Get active Excel worksheet" command

Macro to run

The name of the macro to execute

Any valid macro name

Yes

The macro must exist in the active workbook

Advanced settings

Parameter

Description

Possible Values

Required

Options / Notes

Macro parameters

Parameters to pass to the macro

Any valid parameters

No

Use the "Add parameter" button to add multiple parameters if required

Error handling

Parameter Name

Description

Throw error & stop

When an error occurs, the action will trigger an error and stop the execution of the entire app.

Retry command

If an error occurs, the action will retry the command in an attempt to resolve the issue and continue the process.

Ignore error & continue

When an error occurs, the action will be ignored, and the workflow will continue without interruption.

Variables produced

This action doesn't produce any variables.


Using Variables in Conditions

Parameters in this command can accept variables from previous steps. When you see {x} or a variable icon, you can insert previously created variables by clicking on the field and selecting the desired variable. This is particularly useful when you need to dynamically determine which macro to run based on previous workflow conditions or data.


Notes

  • Before using this command, ensure that an Excel instance has been properly initialized and the workbook containing the macro is open.

  • The macro name must exactly match the name in the Excel file, including case sensitivity.

  • If the macro requires parameters, these can be specified in the Advanced settings.

  • Security settings in Excel may prevent macros from running; ensure macros are enabled in the Excel application.

  • The macro execution happens within the Excel application context, not within the RPA workflow itself.

Did this answer your question?