Archive of Mr Excel Message Board


Back to Excel VBA archive index
Back to archive home



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.

KK


Check out our Excel VBA Resources

Re: Disable the close button in Excel

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

eg.

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

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

Ivan



Re: Disable the close button in Excel

Posted by Killerkris on December 08, 2000 3:34 PM
Thanks u r my savious i owe u for that

KK




This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.