PASS ARRAY AS VBA ARGUMENT THROUGH INVOKE VBA

Hey guys, I made a macro in VBA that extracts some data (as an array) from an xml file (path specified by a string variable).

I am taking this to UI, so that my bot calls a vbs file (Invoke VBA) containing the macro script and pastes the data array in an Excel Sheet.
Right now, I discovered that the arguments I pass to the routine must be of the same type (say, all are String()).

Therefore, I am first passing an array of just one element containing the xml path, however, I am running into some problems, to keep things simple, this is the first line of the vbs:

Sub DatasetsExtraction(ParamArray xmlRutaArray() As Variant)

In UI Studio:


Which is inside an Excel Process Scope and a previous Use Excel File.

ERROR: Invoke VBA: Specified array was not of the expected type.

Any help would be greatly appreciated! :head_shaking_vertically:

Without more detail about your process, it sounds like you’re overcomplicating things. Why wouldn’t you just read the XML in with regular activities, parse it, then write to Excel with the normal Excel activities?

You are right, I am going to “transform” the script used into regular activities.
Still, may I ask what is the common procedure for passing arrays into a script? In case I find it necessary down the road, since checking previous topics couldn’t solve my question.

@romulo.prieto.l,

You can’t pass Array or any other datatype except String. As workaround you can do is pass , separated or any other separator separated string as argument and in your vba code, split it into an array.