How to pass argument inside vb script

Hi,

I have to invoke vb script for some excel operations so that i need to pass the input excel path to vbscript but i am not able to do it. Can anyone help me out how to achieve it.
Dim Arg
Dim File
Set objExcel=CreateObject(“Excel.Application”)
Set Arg = WScript.Arguments

objExcel.Visible = True
File = Arg(0)

Set wb = objExcel.Workbooks.open(File)

Set ws = wb.Sheets(1)

ws.Rows(“1:6”).EntireRow.Delete

wb.Save
wb.Close

objExcel.Quit

This is my vb script

Thanks in Advance

Hi

We can use Invoke code activity where pass the arguments we want in argument property

  • Arguments - The parameters that can be passed to the code that is invoked.

Here you go with an example on how to use it

Cheers @soumi_soumiya

Hi,
Thanks for your response. But by default here we can see input arguments in this invoke VBScript so do we need to extract pass it here or use the option u had mentioned.

Thanks in Advance

image

That’s right
pass arguments with IN direction and call them inside the script

@soumi_soumiya

Yes I had done the same
Set objExcel=CreateObject(“Excel.Application”)

objExcel.Visible = True

Set wb = objExcel.Workbooks.open(““E:\EXCEL\EXCEL\EASY\10000224_976891_SSMAHAVIRAGENCYIDAR.xls””)

Set ws = wb.Sheets(1)

ws.Rows(“1:6”).EntireRow.Delete

wb.Save
wb.Close

objExcel.Quit

This is VB Script that work. Now on this I need to remove the static excel path and pass it as dynamic from uipath

Set objExcel=CreateObject(“Excel.Application”)

objExcel.Visible = True

Set wb = objExcel.Workbooks.open(“WScript.Arguments(0)”)

Set ws = wb.Sheets(1)

ws.Rows(“1:6”).EntireRow.Delete

wb.Save
wb.Close

objExcel.Quit
So I tried with above code passing the argument but still its also not working. Dont know where I am missing out

Thanks in Advance

give a try on removing the surrounding quotes
Set wb = objExcel.Workbooks.open(WScript.Arguments(0))