Using VBScript Statements

Data types aren’t the only things missing. VBScript also lacks several statements. It’s missing all of the statements related to file I/O, such as Open, Close, Read, and Input. Other statements that are not available are Write. GoSub, On GoSub, On GoTo, On Error, and DoEvents. Table 13.5 contains a complete list of all of the available VBScript statements.

Table 13.5: Statements Supported in VBScript

Statement Description
Call Invokes a subroutine
Const Declares a constant value
Dim Declares variables
Do/Loop Executes a loop until a condition or while a condition is True
Erase Reinitializes the contents of a fixed-size array and frees all of the memory allocated to a variable-sized array
For/Next Executes a loop while iterating a variable
For Each/Next Executes a loop while iterating through a collection of objects
Function/End Function Declares a routine that will return a value
If/Then/Else/End If Conditionally executes one set of statements or another
On Error Takes the specified action if an error condition arises
Option Explicit Requires that all variables must be declared before their use
Private Declares private variables
Public Declares public variables
Randomize Initializes the random-number generator
ReDim Changes the size of an array
Select Case/End Select Chooses a single condition from a list of possible conditions
Set Assigns a reference to an object or creates a new object
Sub Declares a subroutine
While/Wend Executes a loop while a condition is True

© 1998 SYBEX Inc. All rights reserved.