Passing Variable using through Invoke VBA activity

Hi All,
I Have a issue to pass a variable from UIpath to VBA Code. Can anyone help me on this . Please find the attached EntryMethodParameter images for your reference and the VBA Code in VBA_1.txt like Range(“C2”).Formula = “=FIND(”" +mnth+ “”,B2)" . And the Error message plz refer attached error image. (Note: the variable mnth is a string)

have we passed all the parameters to the property EntrymethodParameters
,i.e., if we have 5 parameters inside the script then we must have passed 5 parameters here in the property
Kindly check that once pls

Cheers @Subhass

Hi Palaniyappan,

Thanks for the quick reply.
I have only one Parameter. That is mnth. Am not sure,do I need to change the EntryMethodParameter or need to change in VBA Code.

may i know what is the datatype of that variable

It is a string Variable

1 Like

hi @Subhass

may this help you

can i have a view on the screenshot of the vb script if possible

Hello Fernando,

Thanks for the link. Am trying to find input methods in VBA Code.

Yah sure Palaniyappan,

The code as follows. I think something missing to assign and get the variable in my code

Sub MoveBeginning()
Dim LastRow As String
'Move the active sheet to the beginning
ActiveSheet.Copy after:=Worksheets(1)
ActiveSheet.Name = “PRIISM”
Range(“B1”).Delete shift:=xlUp
Range(“A1”).Value = “Name”
Range(“B1”).Value = “Off”
''Range(“C2”).Formula = “=FIND(“Jun”,B2)”
Range(“C2”).Formula = “=FIND(”" +mnth+ “”,B2)"
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
Range(“C2:C” & LastRow).PasteSpecial xlPasteFormulas
With ActiveSheet.UsedRange
.Value = .Value
End With

End Sub


as per function you have not created method parameter, so you have to add parameter in function like below.

Sub MoveBeginning(mnth as string)


1 Like

Now It is working fine. Thanks a lot Sunil

Thanks for the guidance Palaniyappan :slight_smile:

1 Like

Cheers @Subhass

The solution is:
Add the EntryMethodParamter in VBA Code like as below
Sub MoveBeginning(mnth as string) and the code should be Range(“C2”).Formula = “=FIND(”"" +mnth+ “”",B2)".

Thanks a lot @Palaniyappan , @sunilRdGlobal and @fernando_zuluaga