ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   remove close button (https://www.excelbanter.com/excel-programming/274751-re-remove-close-button.html)

Tom Ogilvy

remove close button
 
easier is to use the queryclose event to control the closing of the form:

Private Sub UserForm_QueryClose(cancel As Integer, closemode As Integer)

here are the possible values for the closemode argument

vbFormControlMenu
0
The user has chosen the Close command from the Control menu on the
UserForm.

vbFormCode
1
The Unload statement is invoked from code.

vbAppWindows
2
The current Windows operating environment session is ending.

vbAppTaskManager
3
The Windows Task Manager is closing the application.


From the closemode argument, you can test why the form is being closed - if
you disagree, you can set Cancel = True and display a warning message - for
example if closemode = vbFormControlMenu. If it is one of the other
options, you might perform some cleanup and then let the form close.

--
Regards,
Tom Ogilvy


"Josh Ashcraft" wrote in message
...
how do i remove the close button (X) from the top of a
userform?

Thanks,
Josh





All times are GMT +1. The time now is 04:52 PM.

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