UiPath Macro Help needed

The business is providing an excel with an in built macro say A.
The macro contains one path that is dynamic.
I am planning to pass an arugument and use execute macro.
Please let me know how to achieve ?
I am also open to any alternate solutions.

@Ritaman_Baral

cheers

I want to see the code.
The macro code where we are taking the argument as input

@Ritaman_Baral

you should have like this

Sub Macro_Name(FilePath As String) 

Inside can use the FilePath just as variable

End Sub

cheers

To pass an argument to a macro in UiPath, you can use the Execute macro activity. The Execute macro activity allows you to execute macros that are stored in Excel files.

To use the Execute macro activity, you will need to:

  1. Add the Execute macro activity to your workflow.
  2. In the Macro file property, specify the path to the Excel file that contains the macro.
  3. In the Macro name property, specify the name of the macro.
  4. In the Arguments property, specify the arguments that you want to pass to the macro.

Check this out to know on how to pass parameters to macro

Cheers @Ritaman_Baral

1 Like

There is one more scenarion.
The macro A has a dynamic path .
The bot needs to edit the macro in the excel itself.
how to do that ?

1 Like

@Ritaman_Baral

you just need to save the macro once with adding arguments and can be used

cheers

Well u can use excel application scope and use execute macro within that
Have a view in this thread with similar scenario and git resolved

Hope this helps

Cheers @Ritaman_Baral

Thanks.
The catch is I dont need to run the macro.
The bot needs to edit the path in the macro.

@Ritaman_Baral

May I know why do you want to edit path without running it?

Cheers

The business has provided the macro.
The macro has a path which needs to be edited

Hi @Ritaman_Baral

They provided the code in the Notepad file, open that notepad file and pass the argument as @Anil_G said in the vb code.

Hope it helps!!

Hi @Ritaman_Baral

Click on Developer->VisualBasic

In that you can find the Macro Code

Hope you understand!!

The excel is having in-built macro.

@Ritaman_Baral

The built in macro also can be edited …or you cna ask business to add the path argument

cheers

In that case…
The path will only be edited right ?
I dont want to run the macro…

@Ritaman_Baral

What you want to do with macro after editing?

can you please tell that

one alternative is give the input argument and when someone else is running he/she would get a prompt

cheers

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.