Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Accessing the Solver Add-in in VBA | Excel Discussion (Misc queries) | |||
ActiveX Controls vs Form Controls | Excel Discussion (Misc queries) | |||
Event procedures for controls added with Controls.Add | Excel Programming | |||
Accessing the values of form controls on worksheets in Excel 2000 | Excel Programming | |||
Accessing ActiveX Controls using VBA - can't use Control.Name to access. | Excel Programming |