VBScript VarType Function
Complete VBScript Reference Manual
The VarType function returns a value indicating the subtype of a specified variable.
The VarType function returns the following values:
- 0 = vbEmpty - indicates Empty (uninitialized)
- 1 = vbNull - indicates Null (no valid data)
- 2 = vbInteger - indicates an integer
- 3 = vbLong - indicates a long integer
- 4 = vbSingle - indicates a single-precision floating-point number
- 5 = vbDouble - indicates a double-precision floating-point number
- 6 = vbCurrency - indicates currency
- 7 = vbDate - indicates a date
- 8 = vbString - indicates a string
- 9 = vbObject - indicates an automation object
- 10 = vbError - indicates an error
- 11 = vbBoolean - indicates a Boolean value
- 12 = vbVariant - indicates Variant (used only in arrays of variables)
- 13 = vbDataObject - indicates a data access object
- 17 = vbByte - indicates a byte
- 8192 = vbArray - indicates an array
**Note:** If the variable is an array, VarType() returns 8192 + VarType(array_element). For example, VarType() of an integer array returns 8192 + 2 = 8194.
Syntax
VarType(varname)
| Parameters | Description |
|---|---|
| varname | Required. The name of the variable. |
Example
Example
The example above produces the following output:
8
2
5
1
0
11
Try it »
Complete VBScript Reference Manual