MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Disable the close button in Excel

Posted by Killerkris on December 07, 2000 2:47 PM

Thanks to Ivan Moala for his little tip on hiding sheets made my system nearly done. All i need now is some way to disable the close in the corner or run a macro whenever someone pushes it. Can anyone help me please any ways around this problem are also welcome.


Posted by Ivan Moala on December 07, 2000 3:01 PM

KK all you need is to place some code in the
Thisworkbook object module


Private Sub Workbook_BeforeClose(Cancel As Boolean)
If [your criteria] then
MsgBox "can't close now !!"
Cancel = True
End Sub

The key here being the Cancel = True which will
cancel the close operation.


Posted by Killerkris on December 08, 2000 3:34 PM

Thanks u r my savious i owe u for that