ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   X button question (https://www.excelbanter.com/excel-discussion-misc-queries/45955-x-button-question.html)

Greg B

X button question
 
I was wondering if I would be able to disble the "x" button only on the
userform called "main"?

If so how do I do it?

Thanks

Greg



dominicb


Good afternoon Greg B

This is how to do it:

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As
Integer)
Cancel = True
End Sub

Just don't forget to set up a close button, and if you do, don't forget
that you can crash out of a macro using ctrl + Break.

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=468606


Greg B

Thanks for that I have the exit and save button just didn't want the
opporunity for the person to lose their work from a little error. I have
all other userforms go back to the main sheet if the X button is pressed.

Thanks again

Greg
"dominicb" wrote in
message ...

Good afternoon Greg B

This is how to do it:

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As
Integer)
Cancel = True
End Sub

Just don't forget to set up a close button, and if you do, don't forget
that you can crash out of a macro using ctrl + Break.

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile:
http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=468606





All times are GMT +1. The time now is 04:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com