Invoke code specifics

I tried to run VBS via Invoke code command.

Here is example :

Dim excelApp, wB, wS

Set excelApp = CreateObject(“Excel.Application”)
excelApp.Visible = True
Set wB = excelApp.Workbooks.Open(“filePath/fileName.xls”)
Set wS = wB.Sheets(“sheetName”)


However, Uipath pops up error msgs.
Main errors were…

  1. Variable has to be declared with As statement due to option strict
  2. Set statement is not supported in present step.

Is someone who can solve the problem?

or any other ways to run VBSCript?

or Could you revise the code to work in Uipath?

Simple VBA /VBS code will not work in Invoke Code activity. UI Path has strict on option enabled meaning no late binding is allowed (Set excelApp = CreateObject(“Excel.Application”) will not work). You should use VB .net syntax.

I think you can run VBS through Invoke Power Shell activity, you can use Google to find correct command.

4 Likes

Thank you clearly understand.