Variant type (COM)

Variant is a data type in certain programming languages, particularly Visual Basic, OCaml,[1] Delphi and C++ when using the Component Object Model.

In Visual Basic (and Visual Basic for Applications) the Variant data type is a tagged union that can be used to represent any other data type (for example, integer, floating-point, single- and double-precision, object, etc.)

There are similarities in concept, but also major differences, and no direct conversions exist between these two types.

The Collection class in OLE Automation can store items of different data types.

If in Visual Basic the For Each construct is used, the iterator variable must be of object type, or a variant.