accessing controls
hi all
i have a question about how controls are accessed (maybe that's not phrased properly but i'll try and explain.) i have a multipage with several pages - each page contains labels, textboxes, and comboboxes. when i do: For i = 0 To MultiPage1.Pages.Count - 1 counter = 0 For Each o In MultiPage1.Pages(i).Controls If TypeName(o) < "Label" Then ActiveCell.Offset(0, counter).Value = o.Value counter = counter + 1 End If Next ActiveCell.Offset(0,counter).Select Next i it will go through and put the value of each textbox/combobox in the successive cell on the worksheet. however, the order at which it goes through them is a bit baffling. on page 1 (from top to bottom) the boxes are named: textbox1, textbox2, textbox3....etc and the tab order is set textbox1, textbox2, textbox3.... etc my question is why does it access in this order: 8,1,4,5,6,7,3,2 is there a way to change this order? and secondly - at runtime (when debugging usint the immediate window) is there a way to get the 'name' of the control being looked at? ie if a breakpoint is set at For i = 0 To MultiPage1.Pages.Count - 1 and i am stepping through, how can i see the 'name' (ie textbox1) of the current control? tia! J |
accessing controls
Is the order in which they were added?
-- HTH Bob Phillips "Gixxer_J_97" wrote in message ... hi all i have a question about how controls are accessed (maybe that's not phrased properly but i'll try and explain.) i have a multipage with several pages - each page contains labels, textboxes, and comboboxes. when i do: For i = 0 To MultiPage1.Pages.Count - 1 counter = 0 For Each o In MultiPage1.Pages(i).Controls If TypeName(o) < "Label" Then ActiveCell.Offset(0, counter).Value = o.Value counter = counter + 1 End If Next ActiveCell.Offset(0,counter).Select Next i it will go through and put the value of each textbox/combobox in the successive cell on the worksheet. however, the order at which it goes through them is a bit baffling. on page 1 (from top to bottom) the boxes are named: textbox1, textbox2, textbox3....etc and the tab order is set textbox1, textbox2, textbox3.... etc my question is why does it access in this order: 8,1,4,5,6,7,3,2 is there a way to change this order? and secondly - at runtime (when debugging usint the immediate window) is there a way to get the 'name' of the control being looked at? ie if a breakpoint is set at For i = 0 To MultiPage1.Pages.Count - 1 and i am stepping through, how can i see the 'name' (ie textbox1) of the current control? tia! J |
accessing controls
thats a good question - and it could very well be....
i'll move them around/rename them and see what happens. thanks for the tip Bob J "Bob Phillips" wrote: Is the order in which they were added? -- HTH Bob Phillips "Gixxer_J_97" wrote in message ... hi all i have a question about how controls are accessed (maybe that's not phrased properly but i'll try and explain.) i have a multipage with several pages - each page contains labels, textboxes, and comboboxes. when i do: For i = 0 To MultiPage1.Pages.Count - 1 counter = 0 For Each o In MultiPage1.Pages(i).Controls If TypeName(o) < "Label" Then ActiveCell.Offset(0, counter).Value = o.Value counter = counter + 1 End If Next ActiveCell.Offset(0,counter).Select Next i it will go through and put the value of each textbox/combobox in the successive cell on the worksheet. however, the order at which it goes through them is a bit baffling. on page 1 (from top to bottom) the boxes are named: textbox1, textbox2, textbox3....etc and the tab order is set textbox1, textbox2, textbox3.... etc my question is why does it access in this order: 8,1,4,5,6,7,3,2 is there a way to change this order? and secondly - at runtime (when debugging usint the immediate window) is there a way to get the 'name' of the control being looked at? ie if a breakpoint is set at For i = 0 To MultiPage1.Pages.Count - 1 and i am stepping through, how can i see the 'name' (ie textbox1) of the current control? tia! J |
accessing controls
and yep = that seems to have done it
Thanks Bob! J "Gixxer_J_97" wrote: thats a good question - and it could very well be.... i'll move them around/rename them and see what happens. thanks for the tip Bob J "Bob Phillips" wrote: Is the order in which they were added? -- HTH Bob Phillips "Gixxer_J_97" wrote in message ... hi all i have a question about how controls are accessed (maybe that's not phrased properly but i'll try and explain.) i have a multipage with several pages - each page contains labels, textboxes, and comboboxes. when i do: For i = 0 To MultiPage1.Pages.Count - 1 counter = 0 For Each o In MultiPage1.Pages(i).Controls If TypeName(o) < "Label" Then ActiveCell.Offset(0, counter).Value = o.Value counter = counter + 1 End If Next ActiveCell.Offset(0,counter).Select Next i it will go through and put the value of each textbox/combobox in the successive cell on the worksheet. however, the order at which it goes through them is a bit baffling. on page 1 (from top to bottom) the boxes are named: textbox1, textbox2, textbox3....etc and the tab order is set textbox1, textbox2, textbox3.... etc my question is why does it access in this order: 8,1,4,5,6,7,3,2 is there a way to change this order? and secondly - at runtime (when debugging usint the immediate window) is there a way to get the 'name' of the control being looked at? ie if a breakpoint is set at For i = 0 To MultiPage1.Pages.Count - 1 and i am stepping through, how can i see the 'name' (ie textbox1) of the current control? tia! J |
All times are GMT +1. The time now is 11:39 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com