[RESOLVED] Find out how many labels are in a label array?
Hi there folks!
Would anyone know about Ubound, and if it could tell me how many labels are in a label array? It doesn't matter if it has text in the label caption or not.
My label array is called lblWordLetter, so I tried...
Dim nElements As Long
nElements = UBound(lblWordLetter) - LBound(lblWordLetter) + 1
MsgBox nElements
The problem is I get an error saying "array", and it highlights the word UBound in the code above.
Where did I go wrong? : )
Thanks!
Re: Find out how many labels are in a label array?
It is:
Code:
nElements = lblWordLetter.Ubound
Re: Find out how many labels are in a label array?
Re: Find out how many labels are in a label array?
lblWordLetter.UBound will give you the highest Index in the Array; lblWordLetter.Count will give you the number of elements actually in the Array. This is significant because Control Arrays may not be continuous.
e.g. you can have a lblWordLetter(0), lblWordLetter(2), lblWordLetter(3) without a lblWordLetter(1)
Re: Find out how many labels are in a label array?
Re: Find out how many labels are in a label array?
Thank you! You have all been very helpful!