PDA

View Full Version : Array.Count gives Invalid Qualifier Error



Zigs
02-28-2007, 09:35 PM
This is a frustrating error I am getting because I know the solutions is very simple.

The code is within a class module and is a property get.
Here is the code that gives that Error, where mrngDataLocation is a private dynamic array:


Property Get DataCount() As Long
Let DataCount = mrngDataLocation.Count
End Property

Zigs
02-28-2007, 10:21 PM
After some time I have found out that its got nothing to do with the array being private, but it is about the array not being an object therefore it does not have the Count method associated with it.

I made a function that would do it so the code looks neater:

Function lArrayCount(ByRef vArray As Variant) As Long

lArrayCount = UBound(vArray) - LBound(vArray) + 1

End Function