How to run macro with argument

I am trying to execute macro with argument in UiPath. However, looks like couldn’t give any argument. The execute activity was run without error, but no update to the excel. Does anybody has suggestion?
Here is the example I want to play. The macro will clear the specific sheet.

VBA:
Sub Empty_Sheet(ByVal sheetName As String)
Worksheets(sheetName).Cells.Clear
End Sub

Hi @crazywindy,

Please refer these topics for help.

Regards,
Rahamat

@rahamtullah thanks for response.
I tried the 2nd solution, enclosed the statement with single quote but it was not working, which returned error “Execute macro : The range does not exist”
For the 1st one, looks like the problem was not passing argument to macro.
Do you have working sample can be shared?

@rahamtullah
So weird. I can’t put the statement directly to commandtext of execute macro, but can use variable to pass the value
use
image
instead of
image

No idea why, but working now.

1 Like

Hi,

Is the macro running fine when you try to run it from excel manually.

Regards,
Rahamat

yes, working.