Low Level VBA Protection

Makrini

Well-known Member
Joined
May 22, 2007
Messages
1,035
I know I can never get this completely secure - however the only people that have access to my application are very simplistic users and most won't even try...

I have an application that runs a different query based on "environ" username - to access different levels of information from an Access Database (Noone has access installed on their PC's except me so there is no problem with the directly accessing...)

I need to protect my VBA code so that people can't simply add their own username to the code - or delete the requirement.

Best options?
 

Some videos you may like

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

DonkeyOte

MrExcel MVP
Joined
Sep 6, 2002
Messages
9,123
protect your VBA project in VBEditor with a *decent* password (ie something that your basic users would not think of)

also depending on variable data within the file itself (ie confidentiality etc...) it's often best to use a Before_Close event to use VB property of xlveryhidden to hide all sheets with exception of 1 which is say called "INFO" which has a note to inform users that they must have VB Security set to a level less than or equal to MEDIUM so as to ensure macros are enabled.
Then in conjunction with this have a VBA workbook open event to unhide the previously xlveryhidden sheets and hide the "INFO" sheet.

This means that it macros are enabled the file will open as normal, INFO sheet is hidden etc... all other sheets are visible... if they are not enabled only the INFO sheet can be seen by end user thus removing any *issues* if the file is meant to load specific data on open etc that should only be seen by given end user etc...

Worth noting the advantage of xlveryhidden as opposed to hiding sheets in normal XL as xlveryhidden sheets visibility can not be altered without use of VBA.
 

Makrini

Well-known Member
Joined
May 22, 2007
Messages
1,035
Good ideas.

I guess using an xlveryhidden sheet to contain all the usernames and varying access levels would be useful - that way I can allow users to be added by certain other users with special access.

And yes the data is all about confidentiality - although our security is such that I can put it into a directory accessable by a small number of people who need access to half the information anyhow.

Appreciate the advice.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,511
Messages
5,596,581
Members
414,079
Latest member
Frills

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
Top