ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Disabling Events: Dangerous? (https://www.excelbanter.com/excel-programming/343914-disabling-events-dangerous.html)

JakeyC

Disabling Events: Dangerous?
 
I think I have this one sussed, but wanted to check that there are no
unexpected side-effects!

I have a workbook, which contains several macros. One of which is
triggered by the Workbook_Open event to 'initialise' the worksheets
before the user begins to change it.

During the initialisation, the Workbook_Open macro makes changes which
trigger other event macros, most of which mess up the sheet if they run
during the initialisation.

I assume that the following will stop any other macros running before
the Workbook_Open macro has stopped:

Application.EnableEvents = False
'initialize the Worksheets
Application.EnableEvents = True

But is there anything I've overlooked that might mess other things up?

Thanks for your help.


Dave Peterson

Disabling Events: Dangerous?
 
It sure seems like a reasonable approach to me.

But I think the way you really find out if there's other problems is by testing
the heck out of it.



JakeyC wrote:

I think I have this one sussed, but wanted to check that there are no
unexpected side-effects!

I have a workbook, which contains several macros. One of which is
triggered by the Workbook_Open event to 'initialise' the worksheets
before the user begins to change it.

During the initialisation, the Workbook_Open macro makes changes which
trigger other event macros, most of which mess up the sheet if they run
during the initialisation.

I assume that the following will stop any other macros running before
the Workbook_Open macro has stopped:

Application.EnableEvents = False
'initialize the Worksheets
Application.EnableEvents = True

But is there anything I've overlooked that might mess other things up?

Thanks for your help.


--

Dave Peterson


All times are GMT +1. The time now is 03:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com