ExecuteGlobal预期语句错误VBscript [英] ExecuteGlobal Expected Statement Error VBscript
本文介绍了ExecuteGlobal预期语句错误VBscript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将VBscript包含到另一个VBscript中(有点模拟VBS中的OO),在网上找到了一些东西,对我来说似乎没关系。我一直在 ExecuteGlobal
行获得预期声明 - 错误:
I want to include a VBscript into another VBscript (kinda simulating OO in VBS), found something online and it seems Ok to me. I keep getting an "expected statement"-error on the ExecuteGlobal
line:
Dim scriptLocation
Sub Main
scriptLocation ="script2.vbs"
Include(scriptLocation)
End Sub
Sub Include (strFile)
Dim fsObj : Set fsObj = CreateObject("Scripting.FileSystemObject")
Dim vbsFile : Set vbsFile = fsObj.OpenTextFile(strFile, 1, False)
Dim myFunctionsStr : myFunctionsStr = vbsFile.ReadAll
vbsFile.Close
Set vbsFile = Nothing
Set fsObj = Nothing
ExecuteGlobal myFunctionsStr
End Sub
任何人有任何想法吗?
推荐答案
一条错误消息 ExecuteGlobal
行可能意味着:
An error message on an ExecuteGlobal
line can mean:
- 你成功地弄乱了
ExecuteGlobal
语句。 Surest方式:添加param list(),就像你为包含
Sub call一样 - 你加载的代码
myFunctionStr
应该受到指责。如果你做链接/多重包含这个VBScript错误处理的功能使得找到罪魁祸首很困难。简单的出路:使用cscript运行'library'文件。
- You succeeded in messing the
ExecuteGlobal
statement up. Surest way: add param list () as you did for theInclude
Sub call - The code you loaded into
myFunctionStr
is to blame. If you do chaining/multiple includes this 'feature' of VBScript's error handling makes finding the culprit difficult. Easy way out: run the 'library' files with cscript.
BTW:OOP与包含代码(库)之间没有必要的关系/ modules)。
BTW: There is no necessary relation between OOP and including code (libraries/modules).
这篇关于ExecuteGlobal预期语句错误VBscript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文