Productivity Activities
Last updated Jul 9, 2024

Invoke VBA


Invokes a macro from an external file containing VBA code and runs it against an Excel file. This activity can run macros on any type of Excel file, such as .xls and .xlsx. Can only be used in the Excel Application Scope or Use Excel File activities.
Note: In order for this activity to work, Trust Access to the VBA project object model must be enabled from Excel (File > Options > Trust Center > Trust Center Settings > Macro Settings > Select the Trust Access to the VBA project object model check box).

Configuring the Activity

In the Body of the Activity
  • Target workbook - The workbook on which to execute the VBA function.
  • Code File Path - The path to the macro file which contains the VBA Sub/Function definitions. This field supports only strings or String variables. Use the Browse button to browse for files and select one.
  • Entry Method Name - The Sub/Function name that is to be invoked. Must be present in the macro file supplied in the Code File Path property.
  • Output to - Reference to the value returned by the execution of the invoked code, if any. This output is retrieved as Object variables.
  • Add VBA Argument - Adds an input argument to the VBA Sub/Function:

    • Argument value - The value to be passed to the input argument of the VBA Sub/Function.
Properties panel


  • DisplayName - The display name of the activity.


  • See the information in the Designer panel section.


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


  • See the information in the Designer panel section.
  • 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.