A starting point:
For Each objForm In UserForms
If objForm.Visible Then
For Each objControl In objForm.Controls
MsgBox "Form=" & objForm.Name & ", Control=" & objControl.Name
Next
End If
Next
Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
Sub LoopUserformControls()
Dim Ctrl As Control
For Each Ctrl In Userform1.Controls
If TypeName(Ctrl) = "TextBox" Then
' Do stuff
ElseIf TypeName(Ctrl) = "ComboBox" Then
' Do other stuff
End If
Next Ctrl
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.