Article ID: 159705
Article Last Modified on 11/23/2006
Sub Frame_Options()
UserForm1.Show
End Sub
Private Sub CommandButton1_Click()
Dim x As Control
For Each x in Frame1.Controls 'Loop through the option buttons
'within the Frame
If x.Value = True Then
MsgBox x.Caption 'Display the name of the selected
End If 'option button
Next
End Sub
Private Sub CommandButton1_Click()
Dim x As Control
'Loop through all of the controls in the userform.
For Each x in UserForm1.Controls
'Check for the string "Option" within the caption of each
'control.
If InStr(x.Caption, "Option") Then
'Check the group name.
If x.GroupName = "mygroup1" Then
'Check the status of the option button.
If x.Value = True Then
MsgBox x.Caption
End If
End If
End If
Next
End Sub
Sub No_Frame_Options()
UserForm1.Show 'Displays the UserForm
End Sub
Private Sub OptionButton1_Click()
myoption = "option button 1"
End Sub
Private Sub OptionButton2_Click()
myoption = "option button 2"
End Sub
Private Sub OptionButton3_Click()
myoption = "option button 3"
End Sub
Private Sub CommandButton1_Click()
MsgBox myoption 'display the current value of the global
'variable
End Sub
Public myoption As String
Sub Show_UserForm()
UserForm1.Show
End Sub
groupname property
Additional query words: XL97
Keywords: kbdtacode kbprogramming KB159705