Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Cody,
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 "codytheretriever" wrote in message ... Have 10 forms in an Excel based project. On eight of the forms I need to disable "close" button and double-click capability so that user must only go in directions allowed by form command buttons. On the other two forms using "close" or double-click is ok. Have tried all of the Knowledge Base suggestions but keep getting compile errors for "ambiguous ... blah ... blah ... blah", NOT due to typing errors! Could someone give me SIMPLE directions on how to disable "close" button on a form by form basis? Hope someone can help, and thanks in advance if you can. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Disable dropdown list (Combo box -"Form control") | Excel Worksheet Functions | |||
Disable "save" option on close. | Excel Discussion (Misc queries) | |||
Folder Graphic (in Word & Pub) instead of "Close" button in Excel | Excel Discussion (Misc queries) | |||
Changing data source in pivot table- "Back" button is disable | Excel Discussion (Misc queries) | |||
Need a "save & close" button directly on spreadsheet | Excel Discussion (Misc queries) |