Setting Application.EnableEvents=True after Thisworkbook.Close call
John,
I'm assuming that you don't want to run the Workbook_BeforeClose event: include code like this at
the top of the Workbook_BeforeClose event:
If boolDontRun Then Exit Sub
Declare a global variable in a standard codemodule:
Public boolDontRun As Boolean
Then instead of
Application.EnableEvents = False
ThisWorkbook.Close
Application.EnableEvents = True
Use
boolDontRun = True
ThisWorkbook.Close
HTH,
Bernie
MS Excel MVP
"John Fuller" wrote in message
ups.com...
Is there anyway to get excel to re-enable application events after i
close a workbook.
Right now I have in some code:
Application.EnableEvents = False
ThisWorkbook.Close
Application.EnableEvents = True
However, the enableevents never gets set back to true as the sub stops
running when excel closes. Any help is appreciated.
|