Hello
I want to run macro and pass 2 value (sting) to macro
How to set in MacroParameter ?
Thank you.
Hello
I want to run macro and pass 2 value (sting) to macro
How to set in MacroParameter ?
Thank you.
Hey @Stef_99 ,
Try this method,
Script your macro to read and assign inputs from sheet.
You can use write cell to dynamically change the values in the cells before invoking a vba.
Hope this helps you out.
Thanks,
Gautham.
@Stef_99 ,
If you are using execute macro activity (Modern activity)
Have an assign activity,
LHS
MacroParams ( data type should be Ienumerable)
RHS
New List(Of Object) From {stringVar1, stringVar2}
Where stringVar1 and stringVar2 are the string arguments you want to pass to your macro.
After which you can use the variable MacroParams to set the “Macro Parameters” property of execute macro activity.
Hope either of this suggestions helps you out.
Thanks,
Gautham.
Hi @Stef_99
Refer the attached image in which the macro code is given. Counter is the variable which is passed in the code. If you want to pass another variable just add comma in the main bracket and pass the variable name in it.
In your sequence use invoke vba activity and pass the variables in add parameters window in properties panel of invoke vba activity.
Thanks
Your macro should have a Sub Or Function with 2 input parameters as strings like below. Sub will not return any output if you need anything return then use Function else Sub will work.
Function AdditionTest(num1 As String, num2 As String) As String
AdditionTest = CInt(num1) + CInt(num2)
End Function
Pass parameters like this.
Here is Sample Workflow:
MacroTest.xaml (9.2 KB)
Book1.xlsx (8.2 KB)
Output:
Thanks,
Ashok
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.