keep excel open

  • Thread starter Thread starter Otto Moehrbach
  • Start date Start date
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
 
I've written some code in a workbook that has to run "Forever." It extracts
data from a monitoring system and creates reports. Anyhow, I would like to
know if I can keep excel open. Is there a script or something that will
prevent excel from being closed...
thanks
rpm
 
Back
Top