Posted to microsoft.public.excel.programming
|
|
Application.EnableEvents ... Is Local or Global ?
Bernie,
Those letters after your name of which I am deeply respectful mean that I am
going to stiffen my spine and give it a go YOUR way! I'll let you know how I
get on !
Thanks in advance
Matilda
"Bernie Deitrick" wrote:
Matilda,
I wouldn't toggle the value: I would specifically set it to True or False. And it shouldn't affect
all open workbooks, just the workbook that has the conditional statement added as the first line of
each event procedure.
HTH,
Bernie
MS Excel MVP
"Matilda" wrote in message
...
Thanks, Bernie. After setting the boolean test globally as you suggest,
can I set the events to off in the procedure code, then on again at finish of
execution? I tried this but all the open workbooks seemed to retain the
OFF setting, which is more than a little OFF putting!
If so, I must have toggled once too often, a likelihood I can check.
Many thanks,
Matilda
"Bernie Deitrick" wrote:
Matilda,
Declare a global public boolean, say, boolAllowEvents
and then at the top of each event, use
If Not boolAllowEvents Then Exit Sub
and set it to False when you don't want your events in that one book to run.
HTH,
Bernie
MS Excel MVP
"Matilda" wrote in message
...
Oh Boy - did I find THIS out the hard way :-((((
Is there any way to bypass worksheet settings at procedure level? I would
like to keep the settings in place, but execution at runtime every time a
sheet is accessed is slowing down my code to glacial speed.
Advice appreciated as always,
Matilda
"Chip Pearson" wrote:
EnableEvents is an application-wide setting -- it affects all
event procedures in all open workbook. There is no built-in way
to enable/disable events for a particular workbook.
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
"monir" wrote in message
...
Hello;
Book1.xls and Book2.xls, each has few events.
For editing purposes, if I open Book1 (which has
Application.EnableEvents =
True in its ThisWorkbook Open event module), and then open
Book2 (which has
Application.EnableEvents = False in its ThisWorkbook Open
event), ALL events
in both Book1 and Book2 become disabled !!!
Is this how it supposed to work ???
Thank you.
|