ExecuteStatement Method |
Description
Executes a specified statement.
PowerBASIC Syntax
Arguments
Remarks
The context of the ExecuteStatement method is determined by the object argument. If object is a module, the context is restricted to the named module. If object is the ScriptControl, the context is global.
Example [PowerBASIC]
#INCLUDE "MSSCRIPT.INC"
DIM pSc AS IScriptControl DIM vRes AS VARIANT
' Creates an instance of the Microsoft Script Control pSc = NEWCOM "MSScriptControl.ScriptControl" ' Set the language. It can be "VBScript" or "JScript" pSc.Language = UCODE$("VBScript") ' In the following code, the ExecuteStatement method ' executes the statement and assigns the value 100 to the ' variable x. The next two lines use the Eval method ' to test the statements x = 100 and x = 100/2. pSc.ExecuteStatement UCODE$("x = 100") vRes = pSc.Eval(UCODE$("x = 100")) MSGBOX STR$(CINT(VARIANT#(vRes))) vRes = pSc.Eval(UCODE$("x = 100/2")) MSGBOX STR$(CINT(VARIANT#(vRes)))
|