The Not (Not Array) trickery is wellknown - but it should be wellknown too, that this method destabilizes VB
(not really sure what happens under the hood there - but something definitely does not work "according to plan".
Check this out in a fresh loaded, empty VB-Form-Project.
Others (in old Newsgroup-posts) reported these "Expression too complex" errorsCode:Private Sub Form_Load() Dim Arr() Debug.Print (Not Arr) <> -1 Debug.Print 12 / 3 ' it will give error here (16 - "Expression too complex") End Sub
happening even somewhat delayed (in a completely different place or function) -
but on asking, if "somewhere else in the App" the Not Not Array-Test was used,
the answer was Yes" ... after changing to a different "IsDimensioned"-check the
occasionally happening "Expression too complex" errors went away.
Just for completeness, the simple Function below works with all non-UDT-typed VBArrays
and (when placed in a *.bas) should be enough for most purposes:
OlafCode:Function IsDimmed(Arr As Variant) As Boolean On Error GoTo ReturnFalse IsDimmed = UBound(Arr) >= LBound(Arr) ReturnFalse: End Function




Reply With Quote