Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable Close (X) button in Userforms

Status
Not open for further replies.

be17

Technical User
Feb 7, 2001
26
US
I have created a program in Word97 that has several userforms that prompt the user for information. I do not want them to be able to close out of the forms, as it is mandatory that they select certain options. Is there a way to disable the Close (X) button on the top right corner of the userforms?

 
You can use this:

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
MsgBox "You can't do that!!!"
Cancel = 1
End Sub

Warning!! Just using this code you can't close the form at all. You need to do a little check then set Cancel = 1 if you dont want the form to close.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top