Why does VarType() ALWAYS return 8204 for Arrays
It's simply an error in documentation:
==>type D:\VB_scripts\SO\30511987.vbs
option explicit
Dim ii, aA(3)
aA(1)=5
aA(2)="string"
aA(3)=Now
Wscript.Echo "array", VarType(aA), TypeName(aA)
For ii=0 To UBound(aA)
Wscript.Echo "aA(" & CStr(ii) & ")", VarType(aA(ii)), TypeName(aA(ii))
Next
==>cscript D:\VB_scripts\SO\30511987.vbs
array 8204 Variant()
aA(0) 0 Empty
aA(1) 2 Integer
aA(2) 8 String
aA(3) 7 Date
==>
From documentation
In VBScript, variables are always of one fundamental data type, Variant.
Data contained in the variable can be of any type, but variables itself are always of Variant
type. Checking with VarType
the contents of a position of an array will return the type of data contained. But the array itself is a compound of "cells" of Variant
type
So, in your case VarType
will return vbArray
(8192) + vbVariant
(12) = 8204