TypeName function

Category: Array / Information

Summary

String describing data type.

Syntax

TypeName(varname) The required varname argument is a Variant containing any variable except a variable of a user-defined type.

Example

Example
This example uses the TypeName function to return information about a variable.
' Declare variables.
Dim NullVar, MyType, StrVar As String, IntVar As Integer, CurVar As Currency
Dim ArrayVar (1 To 5) As Integer
NullVar = Null ' Assign Null value.
MyType = TypeName(StrVar) ' Returns "String".
MyType = TypeName(IntVar) ' Returns "Integer".
MyType = TypeName(CurVar) ' Returns "Currency".
MyType = TypeName(NullVar) ' Returns "Null".
MyType = TypeName(ArrayVar) ' Returns "Integer()".

Microsoft Support Page

https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/typename-function

Back to Functions