Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Control Array

Status
Not open for further replies.

gnosis13

Programmer
Jul 13, 2001
263
US
Can you build a control array in VBA? I am trying to access several labels with code and would like to loop through them using a control array, however, VBA doesn't seem to support this.

Ex:
X = 0
Do Until X = 10
label[X].caption = X
X = X + 1
Loop A+, N+, MCP
 
No support but you could build an array of controls yourself
Private aryCtl(9) as object
....
Set aryCtl(0) = label1
Set aryCtl(1) = label2
....
Dim ctl As object
For Each Ctl in aryCtl
...
Next
For X = 0 to Ubound(aryCtl)
....
next Compare Code (Text)
Generate Sort in VB or VBScript
 
Thanks for the fast response. That is a very good idea and would work exactly as I need. Unfortunately, the people who will maintain this code will most likely not be skilled at that level. Thats why I was hoping that Access would handle a simple control array....oh well, they can just put up with a very long function of repetitive code!
A+, N+, MCP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top