ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   preventing Application.EnableEvents = False (https://www.excelbanter.com/excel-programming/357427-preventing-application-enableevents-%3D-false.html)

x taol

preventing Application.EnableEvents = False
 


i want to avoid the preventing excel event to stop.
my workbook have a lot of event procedures.
but, anyone can do stop my event codes using the below code.
Application.EnableEvents = False
He will make the excel application which upper code, and then when the
code run, my workbook events all will stop.
i want to prevent that.

*** Sent via Developersdex http://www.developersdex.com ***

AA2e72E

preventing Application.EnableEvents = False
 
In order to execute the expression that disables events is from the visual
basic editor (alt + F11) in the immediate window or using a sub.

You might have to disable Alt + F11 as soon as your workbook is opened
(Auto+Open).

This wil still permit users access to Tools | Macro | Visual Basic Editor.
In order to disable this you would need something like:

Application.CommandBars.ActiveMenuBar.Controls("To ols").enabled = False

BUT: the latter will affect ALL Excel sessions and yourself ... you won't be
able to get to your code. Not nice!

Perhaps you could use an Application.onTime handler to reset events to true
.... but then users can disable this as well.

Interesting question!

"x taol" wrote:



i want to avoid the preventing excel event to stop.
my workbook have a lot of event procedures.
but, anyone can do stop my event codes using the below code.
Application.EnableEvents = False
He will make the excel application which upper code, and then when the
code run, my workbook events all will stop.
i want to prevent that.

*** Sent via Developersdex http://www.developersdex.com ***



All times are GMT +1. The time now is 04:13 AM.

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