activities
latest
false
UiPath logo, featuring letters U and I in white
Productivity Activities
Last updated Nov 6, 2024

Run Spreadsheet Macro

UiPath.Excel.Activities.Business.ExecuteMacroX

Executes a specified macro within a macro-enabled workbook. You can pass macro arguments and save the output of the macro execution. The activity can be used with an Excel file selected for a parent Use Excel File activity or with the Project Notebook.

Configuring the Activity

In the Body of the Activity
  • Source workbook - Click Plus docs image on the right side of the field, and then select a workbook with the .xslm extension where to run the macro. Alternatively, you can select Open in Advanced Editor and enter a VB expression.
  • Macro name - Click Plus on the right side of the field, and then select Text to enter the macro name in the Text Builder. Alternatively, you can use one of the other options in the menu to indicate the macro name:

    • Data from the Project Notebook, a parent Excel file or Outlook account. For example, select a cell in an Excel file that contains the macro name.
    • Use Saved Value - Select a value in the form of a macro name that you previously saved for later use in the project.
    • Ask when run - Prompt for a name when the project is executed.
    • Open in Advanced Editor - Enter a VB expression.
  • Output to - If the execution of the macro returns a value, click Plus on the right side of the field, and then use one of the options in the menu to indicate where to save the value:

    • Save to the Project Notebook or a parent Excel file. For example, you can save to a cell in an Excel file.
    • Save for Later Use - Save the output for later use in your project as input for another activity.
    • Open in Advanced Editor - Enter a VB expression.
  • Add Macro Argument - Click this button to add an argument to use when executing the macro. Add as many arguments as are required by the macro.

Macro Argument Options

  • Argument value - Click Plus on the right side of the field, and then use one of the other options in the menu to add an argument value:

    • Data from the Project Notebook, a parent Excel file or Outlook account. For example, select a cell in an Excel file, or a field in a selected Outlook email that contains the value.
    • Use Saved Value - Select a value that you previously saved for later use in the project.
    • Text - Enter text in the Text Builder.
    • Number - Enter a numeric value.
    • Ask when run - Prompt for an argument when the project is executed.
    • Open in Advanced Editor - Enter a VB expression.
Properties Panel

Common

  • DisplayName - The name displayed for the activity in the Designer panel.

Input

  • Macro name - See Macro name in the body of the activity.
  • Workbook name - See Source workbook in the body of the activity.

Misc

  • Private - If selected, the values of variables and arguments are no longer logged at Verbose level.

Output

  • Macro result - See Output to in the body of the activity.
  • Configuring the Activity

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.