第1个回答 2014-10-06
对于右上角的 小叉关闭 失效功能,请使用如下代码:
Private Sub UserForm_queryclose(cancel As Integer, closemode As Integer)
If closemode = 0 Then
cancel = True
End If
End Sub
如果自己定义一个按钮关闭窗体,可以加入如下代码:
Private Sub CommandButton1_Click()
UserForm1.Hide
End Sub
-----------------------------------------------
对于满足 2个Textbox和 Optionbotton按钮做了选择,才可以点击 Command2 button 按钮,请使用如下代码:
Private Sub UserForm_Initialize()
CommandButton2.Enabled = False
End Sub
Private Sub TextBox2_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If OptionButton1.Value = True Or OptionButton2.Value = True Then
If TextBox2.Text <> "" And TextBox1.Text <> "" Then
CommandButton2.Enabled = True
Else
CommandButton2.Enabled = False
End If
Else
CommandButton2.Enabled = False
End If
End Sub本回答被提问者和网友采纳