How to remove hardcoded values from Macro and pass the values in runtime in Uipath?

Below is my macro and I want to remove the hardcoded values for ClientFilePath , AID, Processing Comment

Sub Start()

ClientFilePath = ThisWorkbook.Path & "\ABC.xlsx"

AID = 1234455

ProcessingComment = 1234

Call Main(ClientFilePath, AID, ProcessingComment)

End Sub

How to change the values during runtime and pass parameters in execute macro activity

Hi @raygandhit
Instead of ABC add the variable ClientFilePath in your macro code.
In the same way you can assign the varaible instead of hard-coding value.
Pass all the variables as an parameter for execute macro activity

@raygandhit,

You can pass the values to macro with property Macro Parameters - It enables you to pass parameters when executing the macro. This field supports only IEnumerable<object> variables.

Thanks,
Ashok :slight_smile:

I have removed the hardcoded values from macro and below is the screenshot on how I am passing in parameters

Updated macro:
Sub Start(ClientFilePath As String, AID As Integer, ProcessingComment As Integer)

ClientFilePath

AID

ProcessingComment

Call Main(ClientFilePath, AID, ProcessingComment)

End Sub

I am getting error as :

image

@raygandhit,

Keep the Datatype as it is like string, int etc. No need to change it.
Pass it like this to Macro Parameters= New Object(){ClientFilePath,AID,ProcessingComment }

Thanks,
Ashok :slight_smile: