[英]VBScript To Run Excel Macro
I am attempting to run this script 我正在尝试运行此脚本
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"
The name of the macro inside of the Test.bas file is Test() and the file is located at C:\\Test\\Test.bas - now anytime I try to drag a .xlsx file on top of the .vbscript I get an error that reads Test.bas文件内部的宏的名称为Test(),该文件位于C:\\ Test \\ Test.bas-现在,无论何时我尝试将.xlsx文件拖动到.vbscript顶部,我都会读取的错误
Syntax error
语法错误
800A03EA800A03EA
Microsoft VBScript Compilation errorMicrosoft VBScript编译错误
What needs to be altered in this script to remedy that issue? 此脚本中需要更改哪些内容以解决该问题?
Wscript.QuitEnd If
Needs to be fixed to Wscript.QuitEnd If
需要固定为
Wscript.Quit End If
Set oVBC = oBook.VBProject.VBComponents oVBC.Import("C:\\Test\\Test.bas")
to Set oVBC = oBook.VBProject.VBComponents oVBC.Import("C:\\Test\\Test.bas")
为
Set oVBC = oBook.VBProject.VBComponents oVBC.Import("C:\\Test\\Test.bas")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.