S
StevenM
I’ve created a user form with three sets of option buttons (one set with 6
option buttons, another set with 3 options buttons, and another set with 3
options buttons), a text box, and two command buttons. I believe I’ve got
everything to work, except for the command buttons.
The code with the user form contains:
Private Sub CommandButton1_Click()
Me.Hide
End Sub
Private Sub CommandButton2_Click()
Me.Hide
End Sub
The code in the adjacent module contains:
Sub TestUserForm()
UserForm1.Show
If UserForm1.CommandButton2 = True Then
Exit Sub
End If
If UserForm1.OptionButton1 = True Then
MsgBox "BorderStyle #1â€
End If
<etc.>
End Sub
The phrase “UserForm1.OptionButton1 = True†tells me if this option has been
selected, and the phrase “sString = UserForm1.TextBox1.Text†gives me the
text entered into the text box. But the phrase “UserForm1.CommandButton2 =
True†is always false even if that command button has been pressed.
So, could someone be so kind as to explain to me how one determines if the
command button has been pressed on a user form?
Steven Craig Miller
option buttons, another set with 3 options buttons, and another set with 3
options buttons), a text box, and two command buttons. I believe I’ve got
everything to work, except for the command buttons.
The code with the user form contains:
Private Sub CommandButton1_Click()
Me.Hide
End Sub
Private Sub CommandButton2_Click()
Me.Hide
End Sub
The code in the adjacent module contains:
Sub TestUserForm()
UserForm1.Show
If UserForm1.CommandButton2 = True Then
Exit Sub
End If
If UserForm1.OptionButton1 = True Then
MsgBox "BorderStyle #1â€
End If
<etc.>
End Sub
The phrase “UserForm1.OptionButton1 = True†tells me if this option has been
selected, and the phrase “sString = UserForm1.TextBox1.Text†gives me the
text entered into the text box. But the phrase “UserForm1.CommandButton2 =
True†is always false even if that command button has been pressed.
So, could someone be so kind as to explain to me how one determines if the
command button has been pressed on a user form?
Steven Craig Miller