Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Any vba code to disable only close button in Excel workbook, please?
Dear all
Could anyone give me some sample code on disabling the close button in Excel workbook? I tried the Tool - Protect - Check Windows method. But, it will disable the maximize and minimize buttons as well. Moreover, it will minimize the workbook. Please give me some advices. thanks Cheers Bon |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Any vba code to disable only close button in Excel workbook, please?
Hi,
You can use the BeforeClose event of the worrkbook using VBA: Private Sub Workbook_BeforeClose(Cancel As Boolean) If MsgBox("Are you sure", vbQuestion + vbYesNo, "Close the book") = vbNo Then Cancel = True End If End Sub If you use it like this Private Sub Workbook_BeforeClose(Cancel As Boolean) Cancel = True End Sub You will nevere be able to close the workboor or end Excel on a normal way! HTH Executor |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Disable Close Button | Excel Discussion (Misc queries) | |||
Disable the Close Window button of the worksheet | Excel Programming | |||
How to disable a sheet's x(close) button? | Excel Programming | |||
Disable Close X Button On Excel Application | Excel Programming | |||
Disable close button of Modeless Userform | Excel Programming |