VBScript VarType
Function
The VarType function returns a value indicating the subtype of a specified variable.
The VarType function returns the following values:
0 = vbEmpty - Represents Empty (uninitialized)
1 = vbNull - Represents Null (no valid data)
2 = vbInteger - Represents an Integer
3 = vbLong - Represents a Long Integer
4 = vbSingle - Represents a Single-precision floating-point number
5 = vbDouble - Represents a Double-precision floating-point number
6 = vbCurrency - Represents Currency
7 = vbDate - Represents Date
8 = vbString - Represents a String
9 = vbObject - Represents an Automation object
10 = vbError - Represents an Error
11 = vbBoolean - Represents a Boolean
12 = vbVariant - Represents Variant (used only with arrays of variables)
13 = vbDataObject - Represents a Data Access Object
17 = vbByte - Represents a Byte
8192 = vbArray - Represents an Array
Note: If the variable is an array, VarType() returns 8192 + VarType(array_element). For example, the VarType() of an Integer array will return 8192 + 2 = 8194.
Syntax
Parameter | Description |
---|---|
varname | Required. The name of the variable. |
Example
Example
The above example outputs: