Preventing users from accessing VBE code

Dan Pensions

New Member
Joined
May 26, 2006
Messages
5
Hi, I have a spreadsheet which uses a macro.

The spreadsheet itself is protected with the exception of a few essential cells but I cannot seem to find a way of preventing the user from accessing the macro code by pressing alt-F11.

This is a particular problem as the code unlocks the cells temporarily while it updates some of them so the password is visible to all and can easily be changed.

As a result I am looking not only to write-protect the code but to hide it from the user completely.

Any suggestions as to how to achieve this will be greatly appreciated.

cheers, Daniel
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
If you go to the VBE and right click on the project you want to protect, select properties, and then the tab for protection. You can then check the "Lock project for viewing" checkbox and type in a password and confirm it. Then save the project in the VBE and your code should be semi secure. Semi secure because this protection can be cracked with code easily obtained on the net, however, for novice users this probably won't be much of an issue.
 
Upvote 0
The Lock Project for Viewing really only works with viewing the code from within the VBE (and as Excelenator has already mentioned, it isn't completely secure) - if someone was to open up the workbook eg in Notepad, it is still possible to reconstruct the code that you have created.

Best regards

Richard
 
Upvote 0
Cheers guys all good now.

I did try that before but i didn't realise you had to exit and re-open the file so i thought it hadn't worked!

thanks, Daniel
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,728
Members
448,987
Latest member
marion_davis

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