O
Otto Moehrbach
rpm
There is a Before_Workbook_Close event recognized by Excel. The macro
would be:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Cancel = True
End Sub
I don't think you want this though. This macro would prevent you from ever
closing Excel. Ever. Period.
Perhaps there is some condition or cell entry that you would want to use
to allow Excel to close. Something like this maybe:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Range("A1") <> "Close" Then Cancel = True
End Sub
This way you could enter "Close", without the quotes, into cell A1 (or some
other cell) and Excel would then close on command. Note that these macros
have to be placed in the workbook module. HTH Otto
There is a Before_Workbook_Close event recognized by Excel. The macro
would be:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Cancel = True
End Sub
I don't think you want this though. This macro would prevent you from ever
closing Excel. Ever. Period.
Perhaps there is some condition or cell entry that you would want to use
to allow Excel to close. Something like this maybe:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Range("A1") <> "Close" Then Cancel = True
End Sub
This way you could enter "Close", without the quotes, into cell A1 (or some
other cell) and Excel would then close on command. Note that these macros
have to be placed in the workbook module. HTH Otto