View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default How to loop through controls on a MultiPage

"On final approach"...

Sub Test()
Dim x As MSForms.Control

For Each x In UserForm1.Frame1.Controls
If TypeOf x Is MSForms.Label Then
If x.Caption = "Label1" Then
MsgBox "Label1 height is " & x.Height
Else
MsgBox "Caption is not Label1"
End If

ElseIf TypeOf x Is MSForms.ComboBox Then
If x.Name = "ComboBox1" Then
MsgBox "ComboBox1"
Else
MsgBox "Not ComboBox1"
End If

ElseIf TypeOf x is...

End If
Next

End Sub


"42N83W" wrote in message
...
Still getting a type mismatch in the FOR statement.

This worked, but only because my labels weren't blank:

For i = 0 To fra02_01.Controls.Count - 1
If fra02_01.Controls.Item(i) = "" Then
' do stuff
Exit Sub
End If
Next i


-gk-