How to call a macro VBA with parameters from UiPath activity?


did you try invoke code activity .?

I’m not familiar with sending an .xlsm file arguments to use with your macro, but I’d be interested to know if you can.

However, if your VBA is a .vbscript instead then you can use arguments with the Start Process. That requires a little knowledge on how to set up your script, though. The syntax isn’t that much different, but just need to open objects for your Excel file, etc.

I decided to look it up and your syntax for VBA appears to be right.
However, you don’t have it as a string.
You might show what your error is.
If it just needs to be a string then something like that might work.


ThankU ClaytonM it works. Now a tried with two parameters but do not work.

“Call export(”“validation”“,”“validation2"”)"
“Call export(”“validation,validation2"”)"
“export ““validation””,”“validation2"”"
"export ““validation, validation2"””

suggestions ?

Hi, assuming macro name is “export”, I think it should be:

Try that one.


Sorry, you’re right. I change the method name.

now is “export” kk

O tried.

Hmmm. “The range does not exist” makes it sound like there’s a problem inside the macro.
Other than that I’m unsure how to resolve it.

If it’s a problem with the macro, you could open the .xlsm file and create a Button that uses… Call export(“validation”,“validation2”) … so you can see if it runs without errors.

I did it and runs okay. :disappointed:

I didn’t try. How can I use invoke code ? Could you help me ? :pray:

as of now its available in only community edition.are you using community or studio?

studio :frowning:

hang tight :upside_down_face: coming soon…

Perfect !!!

Hi ClaytonM, I tried your solution by including double quotes inside macro parentheses. It is working, but the macro is getting called twice in single “Execute Macro” activity.

help pls,
not it work, i want pass a parameter to macro VBA, name macro is change_sheet(str As String).
sheet parameter type String.

thx :smiley:

try this,