Share via


Visual Basic for Applications Reference

VarType Function Example

This example uses the VarType function to determine the subtype of a variable.

  Dim IntVar, StrVar, DateVar, MyCheck
' Initialize variables.
IntVar = 459: StrVar = "Hello World": DateVar = #2/12/69# 
MyCheck = VarType(IntVar)   ' Returns 2.
MyCheck = VarType(DateVar)   ' Returns 7.
MyCheck = VarType(StrVar)   ' Returns 8.