Visual Basic Script supports a subset of the Visual Basic statements. The following list are the functions supported:
Call statement
Dim statement
Do-Loop statement
Erase statement
Exit statement
For-Next statement
For Each-Next statement
Function statement
If-Then-Else statement
Let statement
LSet statement
Mid statement
MsgBox statement
On Error statement
Private statement
Public statement
Randomize statement
ReDim statement
Rem statement
RSet statement
Set statement
Static statement
Sub statement
While-Wend statement
Visual Basic Script Functions Overview
The following is a list of functions and objects that are supported by Visual Basic Script and operate similarly to the VB counterparts:
Abs function
Asc function
Atn function
Chr function
Cos function
Date function
DateSerial function
DateValue function
Day function
Exp function
Hex function
Hour function
InputBox function
InStr function
Int, Fix functions
LBound function
LCase function
Left function
Len function
Log function
LTrim, RTrim, and Trim functions
Mid function
Minute function
Month function
MsgBox function
Now function
Oct function
Right function
Rnd function
Second function
Sgn function
Sin function
Sqr function
Str function
StrComp function
String function
Tan function
Time function
TimeSerial function
TimeValue function
UBound function
UCase function
Val function
VarType function
Weekday function
Year function
The following sections provide information regarding new functions or functions that behave differently than their VB counterparts.
The Array Function
The Array function returns a variant that contains an array. The following is an example:
Dim aNums as Variant
aNums = Array(1, 2, 3, 4, 5)
This would create an array with five values, 1 through 5. If no arguments are passed to the Array function, the array created is of zero length.
Accessing the elements of an array is done the same way in VBScript as in Visual Basic. For instance,
X = aNums(3)
would assign the value of the third position in the array aNums to the variable X.
Data Conversion Functions
The data conversion functions listed in Table B.1 take one Variant variable as an argument and return that value as the Variant subtype of that function.
For example, the CBool function would take a normal Variant as an argument and return a value into a Variant with the subtype Boolean.