TypeName Function
Syntax
TypeName[$](var)
Group
Description
Return a string indicating the type of value stored in var.
Parameters
Parameters | 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. |
Boolean | Variable contains a Boolean value. |
Byte | Variable contains a Byte value. |
SByte | Variable contains a SByte value. |
Short | Variable contains an Short value. |
UShort | Variable contains an UShort value. |
Integer | Variable contains an Integer value. |
UInteger | Variable contains an UInteger value. |
Long | Variable contains a Long value. |
ULong | Variable contains a ULong value. |
Huge_ | Variable contains a Huge_ value. |
UHuge_ | Variable contains a UHuge_ value. |
Decimal | Variable contains a Decimal 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. |
Variant | Variable contains a variant value. (Only used for arrays of variants.) |
Unknown | Variable contains a non-ActiveX Automation object reference. |
( ) | Variable contains an array value. The TypeName of the element followed by ( ). |
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
See also