Name
ExecuteGlobal Statement
Syntax
ExecuteGlobal statementstatementUse: Required
Data Type: String
A string expression containing zero or more statements for execution.
Description
Executes zero or more statements in the global namespace of a script.
Rules at a Glance
statementmust evaluate to a string containing one or more executable statements. An executable statement is any call to a user-defined procedure or function, or to an intrinsic VBScript command.If
statementcontains multiple statements or lines of code, you can separate them with colons.You can also separate statements or lines of code with embedded line breaks (i.e.,
vbCrLf).If
statementincludes an equal sign, it is interpreted as an assignment rather than an evaluation. For example,x = 3assigns the value 3 to the variable x, rather than comparing the value of the variable x with 3.Code created by
ExecuteGlobalis executed in the script’s global namespace. The global namespace is the following:In ASP and IE, code within a
<SCRIPT>...</SCRIPT>tag, but outside of individual functions or procedures.In Outlook, form-level code outside of individual event handlers, functions, or procedures.
In WSH, code outside of individual functions and procedures.
Example
The example WSH script illustrates the difference between
Execute and ExecuteGlobal. Each is called within the
MainProc procedure to define a
subroutine. Execute creates a
procedure named Proc2; however,
it is only visible if called from MainProc. ExecuteGlobal creates ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access