why don't constants work in select case?

why don't constants work in select case?

Anonymous
Not applicable
228 Views
2 Replies
Message 1 of 3

why don't constants work in select case?

Anonymous
Not applicable
hi,
am I not supposed to be able to use VarType constants to test with a select
case
or am I just doing it wrong?

considering the following:

Sub TESTCASE()
Dim TESTARRAY(0 To 2) As Variant
Dim ARRAY2(2) As Integer '(or string or double or variant)
Dim I As Integer

TESTARRAY(0) = "STRING"
TESTARRAY(1) = 2
TESTARRAY(2) = ARRAY2

For I = LBound(TESTARRAY) To UBound(TESTARRAY)
Debug.Print VarType(TESTARRAY(I))
Select Case VarType(TESTARRAY(I))
''''''''''this works
Case Is = vbString
Debug.Print "case is vbstring"
'''''''this doesn't
'Case Is = vbDouble
''''''''''this works
Case Is = 2
Debug.Print "case is vbDouble"
'''''''this doesn't
Case Is = vbArray
Debug.Print "case is vbArray"
End Select
Next I

End Sub
questions:
(a) why is vbString the only constant that works?

(b) help for VarType Constants says the constant vbArray = 8192
but I get from debug.print vartype(var):
8197 for ar() as double
8204 for ar() as variant
8194 for ar() as integer
8200 for ar() as string
what secret mystery am i missing out on?
anyone care to clue me in?
Thanks
Mark
0 Likes
229 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
okay I'll answer part of my own question
highly perceptive genius realizes after long reflection,,,duh!
> (b) help for VarType Constants says the constant vbArray = 8192
> but I get from debug.print vartype(var):
> 8197 for ar() as double
vbdouble = 5
8192 +5=8197
etc

> what secret mystery am i missing out on?
like maybe think a little???
oh well, like maybe the help file could have at least hinted at that for us
dummies!

> Thanks
> Mark
you're welcome
Me
0 Likes
Message 3 of 3

Anonymous
Not applicable
oh, its moments like these that make one wish they could delete their own
messages

> oh well, like maybe the help file could have at least hinted at that for
us
> dummies!
newsflash!!! there's a scroll bar to the right of the window!!!
scroll to the bottom of the page and there's the explanation.
apologies to everyone
me again
0 Likes