View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default Order of controls in For Each Loop

When I add controls to an array in a For Each loop can I be sure that the
order of these controls in the array is
always the same?

They will be added like for example this:

Sub AddTextBoxesToArray(oForm As UserForm, lStart)

Dim ctl As MSForms.Control
Dim i As Long

i = lStart

For Each ctl In oForm.Controls
If TypeName(ctl) = "TextBox" Then
Set TextBoxes(i).objTextBox = ctl
i = i + 1
End If
Next

End Sub

I can be sure the start element is always the same as this is a Public
constant, but how about the rest?


RBS