You might think about using the UiPath.Database.Activities
Also, depending on the scale of your project, you may want to encrypt that password. The ConnectionString requires a password, so maybe you can decrypt it directly in the ConnectionString creation.
Anyway, if you still want to use a VB script/macro, you can do that in one of two easy ways.
- create a .vbscript file using a script editor, which may have syntax differences than vba. You can then use the .vbs file on the “Invoke VBA” inside an Excel Scope. - since it is inside the Excel scope, it will attach to the file as the activeworkbook. First test the script externally though.
- Place the code in the excel file as a macro-enabled file. Then, use Execute Macro.
both ways will require that you arguments in the top of the function.
For .vbs, it will be like Sub Retrieve_Essbase_USD(user, pass)
and for vba, I think it’s like Sub Retrieve_Essbase_USD(user As String, pass As String) //or SecureString
My vb is rusty sometimes, so you can look up for syntax on these languages if you still have trouble.
for getting it working in UiPath, post what you are trying, and maybe someone can help identify the solution.