TypeName Function
Syntax
TypeName[$](var)
Group
Description
Return a string indicating the type of value stored in var.
Parameter | Description |
---|---|
var | Return a string indicating the type of value stored in this variable. |
Result | Description |
---|---|
Empty | Variant variable is empty. It has never been assigned a value. |
Null | Variant variable is null. |
Integer | Variable contains an integer value. |
Long | Variable contains a long value. |
Single | Variable contains a single value. |
Double | Variable contains a double value. |
Currency | Variable contains a currency value. |
Date | Variable contains a date value. |
String | Variable contains a string value. |
Object | Variable contains an object reference that is not Nothing. (An object may return a type name specific to that type of object.) |
Nothing | Variable contains an object reference that is Nothing. |
Error | Variable contains a error code value. |
Boolean | Variable contains a boolean value. |
Variant | Variable contains a variant value. (Only used for arrays of variants.) |
Unknown | Variable contains a non-ActiveX Automation object reference. |
Byte | Variable contains a byte value. |
( ) | Variable contains an array value. The TypeName of the element followed by ( ). |
See Also: VarType.
Example
Sub Main
Dim X As Variant
Debug.Print TypeName(X) '"Empty"
X = 1
Debug.Print TypeName(X) '"Integer"
X = 100000
Debug.Print TypeName(X) '"Long"
X = 1.1
Debug.Print TypeName(X) '"Double"
X = "A"
Debug.Print TypeName(X) '"String"
Set X = CreateObject("Word.Basic")
Debug.Print TypeName(X) '"Object"
X = Array(0,1,2)
Debug.Print TypeName(X) '"Variant()"
End Sub