TypeName (function)

Syntax TypeName (varname)
Description Returns the type name of the specified variable.
Comments The returned string can be any of the following:
Returned String Returned if varname is
"String" A String.
objecttype A data object variable. In this case, objecttype is the name of the specific object type.
"Integer" An integer.
"Long" A long.
"Single" A single.
"Double" A double
"Currency" A currency value.
"Date" A date value.
"Boolean" A boolean value.
"Error" An error value.
"Empty" An uninitialized variable.
"Null" A variant containing no valid data.
"Object" An OLE automation object.
"Unknown" An unknown type of OLE automation object.
"Nothing" An uninitialized object variable.
class A specific type of OLE automation object. In this case, class is the name of the object as known to OLE.
If Varname is an then
array the returned string can be any of the above strings follows by a empty parenthesis. For example, "Integer()" would be returned for an array of integers.
expression the expression is evaluated and a String representing the resultant data type is returned.
OLE collection TypeName returns the name of that object collection.
Example

                           'The following example defines a subroutine that only accepts
                           'Integer variables. If not passed an Integer, it will inform
                           'the user that there was an error, displaying the actual type
                           'of variable that was passed.
                           Sub Foo(a As Variant)
                             If VarType(a) <> ebInteger Then
                               MsgBox "Foo does not support " & TypeName(a) & " variables"
                             End If
                           End Sub
                        
See Also TypeOf (function)