CitectVBA Programming Reference > CitectVBA Function Reference > Declarations > VarType

VarType

Determines the data type of a Variant variable.

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

Syntax

VarType(VarName)

VarName:

A string representing a valid variable name.

Return Value

These are the return values:

Return Value

Data Type

0

Empty

1

Null

2

Integer

3

Long

4

Single

5

Double

6

Not Applicable

7

Date/Time

8

String

Related Functions

IsDate | IsEmpty | IsNull | IsNumeric

Example

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.