BuiltIn.VarType Method

Applies to TestComplete 15.49, last modified on March 17, 2023
This method is obsolete. See the Remarks section below.


Returns the type of the specified OLEVariant value.



Value [in]    Required    Variant    
Result Integer

Applies To

The method is applied to the following object:


The method has the following parameter:


The OLEVariant value whose type you want to learn.

Result Value

One of the following constants, depending on the Value type:

Note: For the complete list of values, see the Microsoft documentation.

Constant Name Hex Value Integer Value Description
varEmpty 0000h 0 Empty (uninitialized).
varNull 0001h 1 Null (no valid data).
varSmallInt 0002h 2 Signed 16-bit integer.
varInteger 0003h 3 Signed 32-bit integer.
varSingle 0004h 4 Single-precision floating-point number. Number of significant digits: 7-8.
varDouble 0005h 5 Double-precision floating-point number. Number of significant digits: 15-16.
varCurrency 0006h 6 High-precision floating-point number. Number of significant digits: 19-20. Intended to minimize rounding errors in monetary calculations.
varDate 0007h 7 OLE-compatible TDateTime type.
varOleStr 0008h 8 String of 16-bit Unicode characters.
varDispatch 0009h 9 Automation object that implements IDispatch interface. Also, it may refer to the native JavaScript, JScript, Python, C#Script and C++Scripts arrays (see below).
varError 000Ah 10 Code of an OS error.
varBoolean 000Bh 11 Boolean.
varVariant 000Ch 12 Variant.
varUnknown 000Dh 13 Reference to an unknown OLE object.
varShortInt 0010h 16 Signed 8-bit integer.
varByte 0011h 17 Unsigned 8-bit integer.
varWord 0012h 18 Unsigned 16-bit integer.
varLongWord 0013h 19 Unsigned 32-bit integer.
varInt64 0014h 20 Signed 64-bit integer.
varStrArg 48h 72 A COM-compatible string.
varString 100h 256 A reference to a dynamically allocated string (not COM-compatible).
varAny 101h 257 A Variant that can contain any value.
varArray 2000h 8192 Native VBScript or DelphiScript array." Type of array elements is specified by the lower bits. For example, 2003h is an array of integers.
varByRef 4000h 16384 Reference to a value of the type given by the lower bits. For example, 4007h is a reference to a date.


This method is obsolete. It is supported for backward compatibility only. To get the type of a value, use the aqObject.GetVarType method.

For VBScript users:

The name of the VarType routine coincides with the name of the VarType function provided by VBScript. So, if you call the routine in VBScript code and skip the object name (BuiltIn), TestComplete will call VBScript’s function rather than the routine of the BuiltIn object. To solve the problem, place the object name before the routine name, that is, use the syntax BuiltIn.VarType in your VBScript code.

For JavaScript, JScript, Python, C#Script and C++Script users:

The varArray type refers to the so-called “safe array” that is used in VBScript, DelphiScript, Visual Basic 6 and other languages. JavaScript, JScript, Python, C#Script and C++Script use native arrays, so when you use the GetVarType method to get the type of a native array, you get the varDispatch value. To verify that a variable is a native array, use the following code:


if (strictEqual(Object.prototype.toString.call(obj), "[object Array]"))
  // native JavaScript array
  // not a JavaScript array


if (Object.prototype.toString.call(obj) === "[object Array]")
  // native JScript array
  // not a JScript array


if isinstance(obj, list):
  # A native Python array
  # Not a Python array

C++Script, C#Script

if (Object["prototype"]["toString"]["call"](obj) === "[object Array]")
  // native JScript array
  // not a JScript array

See Also

GetVarType Method
VarToStr Method
VarToBool Method
VarToFloat Method
VarToInt Method

Highlight search results