VARTYPE(varname)

Returns the number indicating the data type of a variable (Integer).


varnameThe data type name, expression or variable (Object).

REMARKS
* This function never returns the value for vbArray by itself. It is always added to some other value to indicate an array of a particular type.
* The constant vbVariant is only returned in conjunction with vbArray to indicate that the argument to this function is an array of type Variant.
* For example, the value returned for an array of integers is calculated as vbInteger + vbArray, or 8194. If an object has a default property, VarType (object) returns the type of the object's default property.
* The values returned by this function are represented by the VBA.vbVarType Enumeration.
* You can use the TYPENAME function to return the data type as a string.
* The equivalent .NET function is Microsoft.VisualBasic.Information.VarType
* For the Microsoft documentation refer to docs.microsoft.com

VarType(Empty) = 0 (VBA.vbVarType.vbEmpty) 
VarType( ) = 1 (VBA.vbVarType.vbNull)
VarType(459) = 2 (VBA.vbVarType.vbInteger)
VarType(Weekday(7, vbMonday)) = 2 (VBA.vbVarType.vbInteger)
VarType( ) = 3 (VBA.vbVarType.vbLong)
VarType( ) = 4 (VBA.vbVarType.vbSingle)
VarType(10.5) = 5 (VBA.vbVarType.vbDouble)
VarType( ) = 6 (VBA.vbVarType.vbCurrency)
VarType(VBA.Now()) = 7 (VBA.vbVarType.vbDate)
VarType("02/12/2003") = 8 (VBA.vbVarType.vbString)
VarType( ) = 9 (VBA.vbVarType.vbObject)
VarType( ) = 10 (VBA.vbVarType.vbError)
VarType(False) = 11 (VBA.vbVarType.vbBoolean)
VarType( ) = 12 (VBA.vbVarType.vbVariant)
VarType( ) = 13 (VBA.vbVarType.vbDataObject)
VarType( ) = 14 (VBA.vbVarType.vbDecimal)
VarType( ) = 17 (VBA.vbVarType.vbByte)
VarType( ) = 36 = VBA.vbVarType.vbUserDefinedType)
VarType( ) = 8192 (VBA.vbVarType.vbArray)

© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited Top