【发布时间】:2017-09-22 13:34:51
【问题描述】:
我想将参数传递给我的 .vbs 文件并使用它们。所以我做了一些研究,我尝试使用WshSheel.Auguments 声明。但是在通过命令提示符执行时,它给了我一条错误消息
对象不支持此属性/方法:'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
【问题讨论】:
-
我想在执行时动态传递参数,而不是使用硬编码值。所以有人帮助我如何使用 WScript.Auguments(0) 语句
-
为什么今天有很多关于 vbscript 的初学者问题?你知道这是一种即将死去的语言吗?
-
被覆盖了,随便搜索一下就可以找到。
标签: vbscript