VBScript data type
VBScript has only one data type, called a Variant. A Variant is a special type of data that, depending on how it is used, can contain different categories of information. Because the Variant is the only data type in VBScript, it is also the data type of the return value of all functions in VBScript.
The simplest Variant can contain numeric or string information. A Variant is used as a numeric processing in a numeric context and is used as a string in the context of a string. That is, if you use data that looks like a number, VBScript assumes it is a number and handles it in a digital way. Similarly, if the data used is only a string, VBScript will be treated as a string. You can also include a number in quotation marks ("") to make it a string.
Variant Subtype
In addition to simple numbers or strings, aVariant can further differentiate between specific meanings of numeric information. For example, use numeric information to represent a date or time. When this type of data is used with other date or time data, the result is always expressed as a date or time. Numeric information is varied from Boolean values to floating-point numbers. A Variant contains a numeric information type called a subtype. In most cases, you can put the data you want into a variant , and the variant will operate in the way that best applies to the data it contains.
The following table shows the data subtypes that the Variant contains:
Sub Type |
Description |
Empty |
An uninitialized Variant. For a numeric variable, the value is 0; for a string variable, the value is a zero-length string (""). |
Null |
A Variantthat does not contain any valid data. |
Boolean |
Contains True or False. |
Byte |
Contains integers between 0 and 255. |
Integer |
Contains integers from 32,768 to 32,767. |
Currency |
-922,337,203,685,477.5808 to 922,337,203,685,477.5807. |
Long |
Contains integers from 2,147,483,648 to 2,147,483,647. |
Single |
Contains single-precision floating-point numbers, with a negative range from -3.402823E38 to -1.401298E-45, and a positive range from 1.401298E-45 to 3.402823E38. |
Double |
Contains double-precision floating-point numbers, with a negative range from -1.79769313486232E308 to -4.94065645841247E-324, and a positive range from 4.94065645841247E-324 to 1.79769313486232E308. |
Date (Time) |
Contains a number that represents a date ranging from January 1, 100 to A.D. December 31, 9999. |
String |
Contains a variable-length string with a maximum length of 2 billion characters. |
Object |
Contains objects. |
Error |
Contains the error number. |
You can use conversion functions to transform subtypes of data. Alternatively, you can use the VarType function to return the Variant subtype of the data.
-->