Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How to disable the Exit Button of UserForm in Excel?
|
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Alex
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) If CloseMode = 0 Then Cancel = True End Sub -- XL2002 Regards William "Alex" wrote in message ... | How to disable the Exit Button of UserForm in Excel? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Alex,
Adding to this. There are 4 values for CloseMode 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 may only want to trap value 0, but you may also want to trap 2 and 3. Probably best not to trap 1, else your code won't be able to close it. -- HTH RP (remove nothere from the email address if mailing direct) "William" wrote in message ... Hi Alex Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) If CloseMode = 0 Then Cancel = True End Sub -- XL2002 Regards William "Alex" wrote in message ... | How to disable the Exit Button of UserForm in Excel? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
And since a user typically click the close box when they want out of the form, have
it run the CancelButton_Click code, instead of just hanging there. - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ Bob Phillips wrote: Alex, Adding to this. There are 4 values for CloseMode 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 may only want to trap value 0, but you may also want to trap 2 and 3. Probably best not to trap 1, else your code won't be able to close it. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to get userform Cancel button to invoke Exit Sub in calling macro? | New Users to Excel | |||
how do i make a button from a userform exit onto the document in . | New Users to Excel | |||
Disable Exit button on a UserForm | Excel Discussion (Misc queries) | |||
I can't turn off excel programs with the exit button. What is up. | Excel Discussion (Misc queries) | |||
Disable close button of Modeless Userform | Excel Programming |