我正在使用 VBA 用户窗体。MassPrompt 用户表单有一组六个 GroupNames 和一些文本框。每个 GroupName 包含两个或多个单选按钮。
我希望在 GroupName“GROnly”中的任何元素发生更改时触发以下代码。如果用户基于另一个组中的选择在“GROnly”中做出了不适当的按钮选择,我想显示一条警告消息并再次显示 MassPrompt 用户表单。
现在,我已将代码分配给一个按钮“GROnly_yes”。它有效,但仅在单击该一个按钮时才有效。如何在用户窗体代码中定位它以在单击具有 GroupName“GROnly”的按钮时触发?谢谢你看这个。
Private Sub GROnly_yes_Click()
'Prompt if the GROnly is true and it's inappropriate for the GSetting choice
If GROnly_yes = True And GSetting_renewal = True _
Then
GROnly_yes = False
GROnly_no = True
MsgBox ("The GROnly can't be chosen with a Renewal." & vbNewLine & _
"The GROnly button has been changed to 'NO'.")
UserForm_Initialize
End If
'Other IF statements here.
End Sub