We are currently in the process of making our first production workflow and for a part we wanted to leverage existing VBA code to handle a process. I am utilizing the Execute Macro activity and my string is being passed successfully to the Excel file. However after running through the macro once it runs it again. There are no loops in my test workflow nor in my VBA code so I am perplexed. This seems like a bug with UiPath. I saw a few others post in threads with similar concerns and they received no answers. There was a possible other thread that may have held an answer but the thread was not in english.
Not sure about this Iâve asked @beesheep to confirm if thereâs an answer as my Spanish isnât good enoughâŚ
If not Iâll look into it further, do you have an example .xaml ? You could try running it passing a dummy parameter to see if that works (not a perfect solution admittedly).
https://forum.uipath.com/t/passing-argument-to-excel-macro/3868
RD
So update on this issue. I contacted UiPath directly and received confirmation there is a known bug when calling a macro with parenthesis. Going a bit off memory here since I donât have my work email in front of me but calling a macro like âMyMacroâ should work fine. Calling it like âMyMacro()â or âMyMacro(param1, param2, param3, etcâŚ)â will cause it to run twice. So if you need to pass parameters to it youâll have to pass it from a file or some other means. I didnât get around to testing this out yet but wanted to pass along the information.
Posting a link to @baditaâs response
My macro is still running twice. Looks like this bug is not being addressed. I am using version 2018.2.3
What s the excel pack version used?
Can i see the excel file and workflow?
Excel 2013 (15.0.5041.1000) 32-bit
The workflow calls a Select file activity for the user to select a file.
Then the macro is called to simply output the full path of the file selected.
Somehow the two messages pop up twice.
Main.xaml (7.3 KB)
I canât upload the .xlsm file. But hereâs the very simple macro code:
Sub Test(s As String)
MsgBox s
MsgBox "This message should not appear again."
End Sub
i don`t think you have the latest excel package installed, can you upgrade from Package manager?
you need to change your workflow and pass the arguments in Macro parameters property of the activity.
âStringâ cannot be converted to âSystem.Collections.Generic.IEnumerable(Of Object)â because âCharâ is not derived from âObjectâ, as required for the âOutâ generic parameter âTâ in âInterface IEnumerable(Of Out T)â.
How do you convert String to System.Collections.Generic.IEnumerable to be passed in Macro parameters?
Can you edit my workflow and upload the correct version?
you need to have a list of string variables, as parameters
Ah it works now. Thanks!
It looks like the updated activity fixed my issue as well. Just ran a quick test passing and returning values from a macro and it ran without a duplicate run.