VarType Function
Syntax: 
VarType(var) 
Group: 
 Variable Info 
Description: 
 
Return a number indicating the type of value stored in var. 
 
Parameter 
 Description 
- ar Return a number indicating 
 the type of value stored in this variable. 
Result Value Description
- bEmpty 0 Variant variable 
 is empty. It has never been assigned a value. 
- bNull 1 Variant variable 
 is null. 
- bInteger 2 Variable contains an integer 
 value. 
- bLong 3 Variable contains a long 
 value. 
- bSingle 4 Variable contains a single 
 value. 
- bDouble 5 Variable contains a double 
 value. 
- bCurrency 6 Variable contains a currency 
 value. 
- bDate 7 Variable contains a date 
 value. 
- bString 8 Variable contains a string 
 value. 
- bObject 9 Variable contains an object 
 reference. 
- bError 10 Variable contains a error code value. 
- bBoolean 11 Variable contains a boolean 
 value. 
- bVariant 12 Variable contains a variant value. (Only 
 used for arrays of variants.) 
- bDataObject 13 Variable contains a non-OLE Automation 
 object reference. 
- bDecimal 14 Variable contains a 12 byte fixed precision 
 real. 
- bByte 17 Variable contains a byte 
 value. 
+vbArray 8192 Variable contains an array value. Use VarType( ) And 255 
 to get the type of element stored in the array.
See 
 Also: TypeName. 
Example: 
 
Sub Main 
 
Dim X As Variant 
Debug.Print VarType(X) ' 0 
X = 1 
Debug.Print VarType(X) ' 2 
X = 100000 
Debug.Print VarType(X) ' 3 
X = 1.1 
Debug.Print VarType(X) ' 5 
X = "A" 
Debug.Print VarType(X) ' 8 
Set X = CreateObject("Word.Basic") 
 
Debug.Print VarType(X) ' 9 
X = Array(0,1,2) 
Debug.Print VarType(X) ' 8204 (8192+12) 
 
End Sub