ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Application.EnableEvents ... Is Local or Global ? (https://www.excelbanter.com/excel-programming/358742-application-enableevents-local-global.html)

monir

Application.EnableEvents ... Is Local or Global ?
 
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.

Chip Pearson

Application.EnableEvents ... Is Local or Global ?
 
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.




Doug Glancy

Application.EnableEvents ... Is Local or Global ?
 
monir,

Properties of the Application object, such as EnableEventsand
ScreenUpdating, apply to all of Excel, i.e., they are global.

hth,

Doug

"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.




monir

Application.EnableEvents ... Is Local or Global ?
 
Chip & Doug;
Thank you very much for the clarification.


"Doug Glancy" wrote:

monir,

Properties of the Application object, such as EnableEventsand
ScreenUpdating, apply to all of Excel, i.e., they are global.

hth,

Doug

"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.





monir

Application.EnableEvents ... Is Local or Global ?
 
Now ... If I open Book2 first (which has Application.EnableEvents = False),
then open Book1 (which has Application.EnableEvents = True), then why ALL
events in both Book1 & Book2 become also disabled ?

And, if I move the above Aapplication object from ThisWorkBook open event to
a Worksheet event, would this make any differenece on how it's treated?

Thanks again.


"monir" wrote:

Chip & Doug;
Thank you very much for the clarification.


"Doug Glancy" wrote:

monir,

Properties of the Application object, such as EnableEventsand
ScreenUpdating, apply to all of Excel, i.e., they are global.

hth,

Doug

"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.





Chip Pearson

Application.EnableEvents ... Is Local or Global ?
 
If you disable events in Book2, and then open Book1, events won't
fire in Book1 because Book2 disabled events, so your
Workbook_Open event procedure won't run.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"monir" wrote in message
...
Now ... If I open Book2 first (which has
Application.EnableEvents = False),
then open Book1 (which has Application.EnableEvents = True),
then why ALL
events in both Book1 & Book2 become also disabled ?

And, if I move the above Aapplication object from ThisWorkBook
open event to
a Worksheet event, would this make any differenece on how it's
treated?

Thanks again.


"monir" wrote:

Chip & Doug;
Thank you very much for the clarification.


"Doug Glancy" wrote:

monir,

Properties of the Application object, such as
EnableEventsand
ScreenUpdating, apply to all of Excel, i.e., they are
global.

hth,

Doug

"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.






Matilda

Application.EnableEvents ... Is Local or Global ?
 
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.





Bernie Deitrick

Application.EnableEvents ... Is Local or Global ?
 
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.







Matilda

Application.EnableEvents ... Is Local or Global ?
 

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.







Bernie Deitrick

Application.EnableEvents ... Is Local or Global ?
 
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.









Matilda

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.










Bernie Deitrick

Application.EnableEvents ... Is Local or Global ?
 
Matilda,

If you have a problem with this technique, I will send you a working example, with two sheets, one
of which can have the events disabled while the events on the other are unaffected. Contact me
privately if you require the example workbook.

HTH,
Bernie
MS Excel MVP


"Matilda" wrote in message
...
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.













All times are GMT +1. The time now is 11:57 PM.

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