Activities
latest
false
Banner background image
Productivity Activities
Last updated Mar 27, 2024

Invoke VBA

UiPath.Excel.Activities.InvokeVBA

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).

Properties

Common
  • DisplayName - The display name of the activity.
Input
  • Code File Path - The path to the macro file which contains the VBA Sub/Function definitions. This field supports only strings or String variables.
  • 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.
  • Entry Method Parameters - A list of up to 30 parameters that can be passed to the entry method. This field supports only IEnumerable<object> variables.
Misc
  • Private - If selected, the values of variables and arguments are no longer logged at Verbose level.
Output
  • Output Value - The value returned by the execution of the invoked code, if any. This output is retrieved as Object variables.

Example of using the Invoke VBA Activity

To exemplify how to use this activity, we have built an automation project which imports VBA code from a text file, inputs a variable defined in UiPath, and outputs the name of sheets of the included Excel file.

  • Properties
  • Example of using the Invoke VBA 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.