Preventing users from disabling events

bill

Well-known Member
Joined
Mar 7, 2002
Messages
550
Suppose you drive a workbook based on events like
WORKBOOK_CHANGE.

Suppose futher that the workbook is locked to prevent users from viewing the VBA.

But suppose a user enters the VBA EDITOR and in the IMMEDIATE WINDOWS, executes:

Application.EnableEvents = False

All of your hard event driven code now fails...

How do you prevent users from performing the above? I guess that means, preventing users from kicking off their macros when your workbook is open OR preventing users from access to the VBE when your workbook is open.

But also that means disabling any add-ins that turn off event handling as well...

Perhaps you can capture the events state change and if 'not authorized', disable the attempt?

Thoughts?
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
You cannot do take over someone else's computer to that extent.

Even if it were technically feasible, it would be an incredibly hostile design. How would you like it if when you ran a particular program it disabled everything else on your computer?

Suppose you drive a workbook based on events like
WORKBOOK_CHANGE.

Suppose futher that the workbook is locked to prevent users from viewing the VBA.

But suppose a user enters the VBA EDITOR and in the IMMEDIATE WINDOWS, executes:

Application.EnableEvents = False

All of your hard event driven code now fails...

How do you prevent users from performing the above? I guess that means, preventing users from kicking off their macros when your workbook is open OR preventing users from access to the VBE when your workbook is open.

But also that means disabling any add-ins that turn off event handling as well...

Perhaps you can capture the events state change and if 'not authorized', disable the attempt?

Thoughts?
 
Upvote 0
Not really concerned regards how hostile the technique is preceived nor do I believe that I'm advocating the 'takeover' of a users machine. Rather, I'm charged with delivering an airtight, production quality workbook for my firm.

From this vantage, the criticality of the application (based on the business driver) dictate how I will proceed.

And who is talking abouy disabling everything on a users machine? You alone.

I suppose I should appreciate your ethics and how you've manipulated my question into being one based on moral responsibility but frankly, it's of little interest to me. I don't work for SONY and I'm not developing a rootkit.

Not too sure if your first line of reply is ethically based. I feel confident from a pure Excel standpoint, it's technically not possible. But with perhaps the right API calls, or perhaps with a COM addin, I suppose it is possible.
 
Upvote 0
You could always put
Application.EnableEvents = True

at the start of each procedure in your workbook.
 
Upvote 0
Thanks for your reply:)

However, that won't prevent users from issuing a

Application.EnableEvents = False

after the workbook has loaded if they have access to the VBE or to macros/addins that set the property on their behalf:(
 
Upvote 0
If you enter the code at the beginning of every pice of code that might run in your workbook, then that willl work surely, as whatever they might have done to set it to False will immediately be overridden?
 
Upvote 0
True but once it's set to FALSE, it can only be set back to TRUE proactively (ie, user clicks a button which is tied to a macro that can re-enable the TRUE state). They may NOT decide (or NOT need) to trigger code but if they do, it's quite possible the damage may already be done.

For example, assume a workbook is consumed by a web server
1) User enters data, saves and then uploads a WB to a web server.
2) Server code tears the file apart and stores data elements into a table.
3) Invoicing (whatever) is generated based on the table.

As you may know, for a number of reason, Micosoft does NOT recommend installing Excel on a server thereby forcing businesses to opt for a 3rd party tool which can be used to read and write to XLS files but with some tools (or all), events are not supported. This means once the file hits the server, it can't throughly test if all business logic was implemented correctly.

4) Incorrect invoices affect 'the bottom line'
5) Business comes to developer and asks why incorrect data made it's with into the tables:(
 
Upvote 0
OK I give in!!!
Hope you can figure out some other way, good luck.
 
Upvote 0
Edit: Post deleted. It really is not worth my while to participate in this "discussion."
Not really concerned regards how hostile the technique is preceived nor do I believe that I'm advocating the 'takeover' of a users machine. Rather, I'm charged with delivering an airtight, production quality workbook for my firm.

From this vantage, the criticality of the application (based on the business driver) dictate how I will proceed.

And who is talking abouy disabling everything on a users machine? You alone.

I suppose I should appreciate your ethics and how you've manipulated my question into being one based on moral responsibility but frankly, it's of little interest to me. I don't work for SONY and I'm not developing a rootkit.

Not too sure if your first line of reply is ethically based. I feel confident from a pure Excel standpoint, it's technically not possible. But with perhaps the right API calls, or perhaps with a COM addin, I suppose it is possible.
 
Upvote 0

Forum statistics

Threads
1,214,517
Messages
6,119,984
Members
448,935
Latest member
ijat

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top