How to pass file path dynamically in Invoke VbScript Activity?

HI Team,
Good Afternoon!

I want to arrange the columns of my excel file which contains multiple sheets.

Columns get added like

BL01, BL05, BL04, BL03

So , I want to arrange this columns in sequential order such as BL01, BL02,BL03, BL04, BL05

I have have vb script which works as expected .

Now I want to pass excel file path in VBscrip dynamically,

’ VBScript to rearrange columns dynamically in all sheets and save the Excel file
Set objExcel = CreateObject(“Excel.Application”)
objExcel.Visible = False ’ Set to True if you want to see Excel during execution

’ Open the workbook (Modify the file path as per your file location)
**Set objWorkbook = objExcel.Workbooks.Open(“C:\Path\To\Your\File.xlsx”)

Please let me suggest the solution for the same.

Thank you so much in advance!!!

Hi @Sanket_Shinde1

Refer the below videos,

https://www.youtube.com/watch?v=le6N6qlOAiU

https://www.youtube.com/watch?v=j7MXXYJjQGg

Regards,
Gowtham K

1 Like

@Sanket_Shinde1,

Click on Input Arguments and pass a string argument with your dynamic file path

Inside you script, replace your hard coded file with this code:
Set objWorkbook = objExcel.Workbooks.Open(WScript.Arguments(0))

1 Like

Thank you so much @ashokkarale

1 Like

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