![]() |
Disabling the "X" (Close) on a UserForm
Is there a way in which to disable the X on a UserForm so
that User can not close out the form? I need to be able to do this for a spreadsheet that is used in both XL97 and XL02. Any help would be appreciated. Thanks. Kirk |
Disabling the "X" (Close) on a UserForm
Thanks a lot. That worked PERFECT.
Kirk -----Original Message----- Kirk, Use the form's QueryClose event. This has 2 arguments, Cancel and CloseMode. CloseMode tells you where the close originates from. 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. You can test this, and if it's from an unload statement, close else cancel Private Sub CommandButton1_Click() Unload Me End Sub Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) Cancel = CloseMode < vbFormCode And CloseMode < vbAppWindows End Sub -- HTH Bob Phillips "Kirk" wrote in message ... Is there a way in which to disable the X on a UserForm so that User can not close out the form? I need to be able to do this for a spreadsheet that is used in both XL97 and XL02. Any help would be appreciated. Thanks. Kirk . |
All times are GMT +1. The time now is 06:11 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com