accessing controls

G

Gixxer_J_97

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
 
G

Gixxer_J_97

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top