InvokeVBAX

Hi, i have set up a process as below

but what value should I include in the “Target Workbook”?

Hi @Hengshi_Teo

Can you specify what are you trying to achieve and what is the error that is throwing in Invoke VBA activity.

Regards

@Hengshi_Teo

invoke vba to be used inside use excel file activity …which would give you option to give excel handle in the workbook field

cheers

Hi @Hengshi_Teo

To make it work, first use the Excel Process scope activity, and within it, place the Use Excel File activity. Inside that, insert the Invoke VBA activity to interact with the Excel file.

Provide the Excel file path in the Use Excel File activity. Any actions you define within the Use Excel File activity will then be performed on the specified Excel file.

Check the below image for better understanding,

Hope it helps!!

Thanks all for the prompt response!

Background:

I wanted to create a bot to open up the Excel file with a few worksheets. Generally, I will need the bot to do:

  1. Extract unique values from column “GL Accounts”;
  2. If the existing worksheet names are not present in the unique values; then create new worksheet and copy the first row in “Data” worksheet over to the new worksheet
  3. Copy all data with the respective “GL Accounts” into the respective worksheets.

Solutioning:

I tried the method that @Anil_G and @mkankatala mentioned, so the error has gone. After reading around, I noted that Code file path is referencing the external file so then how do I execute the VBA (vbaCode)?

Appreciate the assistance! Been awhile since i last played around with UiPath

@Hengshi_Teo

just save the file as .vba or a text file and give the file path

and entry method name should be worksheetexists as in your vba

and click add vba parameter and there give the sheetname you would want to pass

cheers

1 Like

I need this to be portable :smiley: hence that’s why I am trying to embed it within the bot…

1 Like

@Hengshi_Teo

the code file can be kept with project files itself so that it can be portable as all files in the project folder are also packed along with other files

cheers

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.