我正在尝试运行此脚本
if WScript.Arguments.Count < 1 Then
WScript.Echo "Drop file on to me to process."
Wscript.QuitEnd If
Set oExcel = CreateObject("Excel.Application")
Set oBook = oExcel.Workbooks.Open(Wscript.Arguments.Item(0))
Set oVBC = oBook.VBProject.VBComponents oVBC.Import("C:\Test\Test.bas")
oBook.Application.Run "Test"
WScript.Echo "Done"
Test.bas文件中的宏名称是Test(),文件位于C:\ Test \ Test.bas - 现在我随时尝试将.xlsx文件拖到.vbscript之上我收到一条错误,内容为
语法错误
800A03EA
Microsoft VBScript编译错误
在此脚本中需要更改哪些内容才能解决该问题?
答案 0 :(得分:1)
Wscript.QuitEnd If
需要修复
Wscript.Quit
End If
Set oVBC = oBook.VBProject.VBComponents oVBC.Import("C:\Test\Test.bas")
到
Set oVBC = oBook.VBProject.VBComponents
oVBC.Import("C:\Test\Test.bas")