How do i replace a value in macro with a variable and use that variable while running execute macro activity

Hi guys,

Below is the macro code:

Sub ClickAug()

’ ClickAug Macro


ActiveWorkbook.SlicerCaches(“Slicer_Month_name”).VisibleSlicerItemsList = Array _
( _
“[Months_t].[Month_name].&[Aug]”)

I need to replace month name , [Aug ] with a variable . and also I need to paas a value to this variable using execute macro activity.

Can anyone help me edit this code and also please let me know how do I pass variable to this macro.

Your help is greatly appreciated.

Thankyou

Hi
Welcome back to uipath community
We can mention a variable in macro
so if we are trying to pass variables in the parameters it can be done like this
{""+exampleVariable+""} in the MACROS PARAMETER Property
or
–if we are trying to values in the parameters in the property then like this
as per your scenario
{“stringvalue”,int32value}

and in the MACRO we need to mention the receiving argument with @ symbol before to the argument name like this
@argumentname

Cheers @poojakumari2793

1 Like

Hi I tried editing my code as below:

Sub checkvar()

Dim strMonth As String

’ checkvar Macro


ActiveWorkbook.SlicerCaches(“Slicer_Month_name”).VisibleSlicerItemsList = Array _
( _
“[Months_t].[Month_name].&[&strMonth&]”)
End Sub

but it throws error:

Macro_Uipth%20snap Run_Macro_error