HackLife
asked on
VBScript: How do I import another VBS file as an include?
VBScript: How do I import another VBS file as an include?
If there is a uniform way to do it, I would like to know how? If not, I would like to know if there is a back door way to perform this. Thanks.
If there is a uniform way to do it, I would like to know how? If not, I would like to know if there is a back door way to perform this. Thanks.
Why not just set the vbsfile as a Constant:
Dim wshell
Const VBSFILE = "Somefile.vbs"
Set wshell = CreateObject("WScript.Shel l")
wshell.Run VBSFILE
Set wshell = Nothing
Dim wshell
Const VBSFILE = "Somefile.vbs"
Set wshell = CreateObject("WScript.Shel
wshell.Run VBSFILE
Set wshell = Nothing
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Because I'm including classes and "run" will not help any.
ASKER
Eval
ExecuteGlobal
Execute
and how to use them.
I found this in another board:
Include "somecode.vbs"
Sub Include(sCodeFile)
Dim sCode
with createobject("scripting.fi
sCode = .OpenTextFile(sCodeFile).R
End With
ExecuteGlobal sCode
End Sub