control arrays
I'm using VBA with Excel 5 and developing a form. Under VB6 I'd create a
control array to allow me to access 10 text boxes using a loop. VBA doesn't appear to allow this. Is there any way to simulate a control array eg by programatically modifying the names of the text boxes? Thanks |
control arrays
VBA do not allow control arrays. Instead you can consider one of the below
two approaches '------If the textboxes are named as TExtbox1,TExtbox2 ...Textbox10 Dim intCount as Integer For intCount = 1 To 10 Me.Controls("Textbox" & intCount).Text = intCount Next '-------If you are not sure of the textbox names you can try the below Dim Ctl As MSForms.Control For Each Ctl In UserForm1.Controls If TypeOf Ctl Is MSForms.TextBox Then ' do something MsgBox Ctl.Name End If Next -- Jacob "vb6user" wrote: I'm using VBA with Excel 5 and developing a form. Under VB6 I'd create a control array to allow me to access 10 text boxes using a loop. VBA doesn't appear to allow this. Is there any way to simulate a control array eg by programatically modifying the names of the text boxes? Thanks |
control arrays
You can emulate a control array with an event class, but unfortunately not
all of the events are exposed to this class. Which events are you after? --- HTH Bob Phillips "vb6user" wrote in message ... I'm using VBA with Excel 5 and developing a form. Under VB6 I'd create a control array to allow me to access 10 text boxes using a loop. VBA doesn't appear to allow this. Is there any way to simulate a control array eg by programatically modifying the names of the text boxes? Thanks |
All times are GMT +1. The time now is 02:02 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com