Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

VBScript VarType function


May 13, 2021 VBScript


Table of contents


VBScript VarType function

The VBScript VarType function returns a value that identifies the subtype of the variant.


VBScript VarType function Complete VBScript reference manual

The VarType function returns a value that indicates the subtype of the specified variable.

The VarType function returns the following value:

  • 0 s vbEmpty - empty (not initialized)
  • 1 - vbNull - Null (no valid data)
  • 2 - vbInteger - represents an integer
  • 3 - vbLong - represents a long integer
  • 4 - vbSingle - represents a single-precision floating point
  • 5 - vbDouble - represents a double float
  • 6 - vbCurrency - represents currency
  • 7 - vbDate - represents the date
  • 8 - vbString - represents a string
  • 9 - vbObject - represents an automation object
  • 10 - vbError - indicates an error
  • 11 - vbBoolean - represents a Boolean value
  • 12 - vbVariant - for Variant (array of variables only)
  • 13 - vbDataObject - represents a data access object
  • 17 - vbByte - represents a byte
  • 8192 - vbArray - represents an array

Note: If the variable is an array, VarType() returns 8192 plus VarType (array_element). For example, VarType() of the integer array returns 8192 plus 2 plus 8194.

Grammar

VarType(varname)

parameter describe
varname Required.The name of the variable.
<script type="text/vbscript">

x="Hello World!"
document.write(VarType(x) & "<br />")
x=4
document.write(VarType(x) & "<br />")
x=4.675
document.write(VarType(x) & "<br />")
x=Null
document.write(VarType(x) & "<br />")
x=Empty
document.write(VarType(x) & "<br />")
x=True
document.write(VarType(x))

</script>

The above example output results:

8
2
5
1
0
11

Try it out . . .

VBScript VarType function Complete VBScript reference manual