How To Execute Macro – In UiPath

To automate few excel tasks, we might sometimes consider macros during our RPA implementation.

let’s see how to execute a macro through UiPath…!!!

Example

Implementation using UiPath :

Let us implement a workflow to create serial numbers in excel file according to the user using a macro code.

(Please ignore the macro code if you don’t understand it, because our goal here is to learn the integration rather than the macro code)

Macro(File has been attached in the source code- Open the excel file and press ALT+11 key to display the macro):
UiPath Execute Macro 8.PNG

***(This code will create the serial numbers starting from the active cell)

Step 1:
Drag “Input Dialogue Box” activity into the designer panel and store the user provide data into a variable.

UiPath Execute Macro 1UiPath Execute Macro 2

Step 2:
Drag “Excel application scope” activity into the designer panel and pass the excel file to it which contain the macro code in it.

UiPath Execute Macro 3UiPath Execute Macro 4

Step 3:
Drag “Execute macro” activity into the designer and supply the Macro Name and Macro Parameters to it.

Here:
MicroName: “AddSerialNumbers” 
MacroParameters: {userInput} (The function here accepts only one argument)

UiPath Execute Macro 5UiPath Execute Macro 6

Step 4:
Finally, execute the workflow 🙂

UiPath Execute Macro 9.PNG

Click here to download the Source Code…

Hope it has helped you… 

Advertisements

Author: Sharath Raju

Founder@www.ExcelCult.com

Leave a Reply