Hello Everyone,
I am having trouble when using my forms. Whenever I used this code, the form will not allow me to close the form using the 'X' button and instead having to click cancel to close. I have been tasked to takeover a marco from a previous designer and I am wondering if there is a way to get around using the X instead of cancel.
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
MsgBox "Use the Cancel Button!"
Cancel = True
End If
End Sub
Thanks!
Private Sub Cancel_Click()
Tag = "Closed"
Me.Hide
End Sub
I am having trouble when using my forms. Whenever I used this code, the form will not allow me to close the form using the 'X' button and instead having to click cancel to close. I have been tasked to takeover a marco from a previous designer and I am wondering if there is a way to get around using the X instead of cancel.
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
MsgBox "Use the Cancel Button!"
Cancel = True
End If
End Sub
Thanks!
Private Sub Cancel_Click()
Tag = "Closed"
Me.Hide
End Sub