1

I want to pass arguments in to my .vbs file and use them. So I did some research I tried to use WshSheel.Auguments statement. But while executing through command prompt it is giving me an error message

object does not support this property/method:'WScript.Auguments'

Dim objExcel, strExcelPath, objSheet

'strValue=WScript.Auguments(0)
'arrValue=Split(strValue,"|")
Set WshSheel = CreateObject("WScript.Shell")
strExcelPath ="C:\Users\Z997710\Desktop\pension1.xlsx"

' Open specified spreadsheet and select the first worksheet.
Set objExcel = CreateObject("Excel.Application")
objExcel.WorkBooks.Open strExcelPath
Set objSheet = objExcel.ActiveWorkbook.Worksheets(3)

' Modify a cell.

'objSheet.Cells(2, 1).Value =20
objSheet.Cells(2, 1).Value =WScript.Auguments(0)
objSheet.Cells(2, 2).Value ="09/02/2015"
objSheet.Cells(2, 3).Value ="09/02/2020"
'objSheet.Cells(2, 1).Value =Trim(arrValue(0))
'objSheet.Cells(2, 2).Value =Trim(arrValue(0))

strValue=objSheet.Cells(12, 4).Value

objSheet.Cells(12, 5).Value = strValue
msgbox strValue

' Save and quit.`enter code here`
objExcel.ActiveWorkbook.Save
objExcel.ActiveWorkbook.Close
objExcel.Application.Quit
'WScript.Quit
4
  • instead of using hard coded value i want to pass parameters dynamically while exectuion. So some one help me how to use the WScript.Auguments(0) statement Commented Apr 25, 2017 at 13:42
  • Why the many beginner questions about vbscript this day ? it's a dying language you know ? Commented Apr 25, 2017 at 14:02
  • 1
    Possible duplicate of Using command line arguments in VBscript Commented Apr 25, 2017 at 14:02
  • It's been covered just search and you will find. Commented Apr 25, 2017 at 14:03

1 Answer 1

0

It's Wscript.Arguments, not .Auguments

Try this one line script in a console window with one parameter

Wscript.Echo Wscript.arguments(0)
Sign up to request clarification or add additional context in comments.

6 Comments

It's been covered. Also instead of pointing out typos, why not edit the question and correct them?
HI peter thank you so much for help. Actually tried to update value in excel using selenium code but while retriving after updating i am getting previuos value only from formula cell. so trying to update excel using vb script and fetch value.
@Vinay shame you didn't search first.
@Vinay, you'd better edit your question and tell us the current error, the object does not support this property/method:'WScript.Auguments' is what I responded on
@ lankymart : Thanks for effort :)
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.