When you are using controls in a Form then you need to try this...I'm still failing at simply looping through all the controls on my form
vb Code:
Private Sub CommandButton1_Click() Dim ctl As Control For Each ctl In Me.Controls If TypeName(ctl) = "OptionButton" Then MsgBox ctl.Name ElseIf TypeName(ctl) = "CommandButton" Then MsgBox ctl.Name ElseIf TypeName(ctl) = "Frame" Then MsgBox ctl.Name End If Next End Sub




Reply With Quote