Reputation: 43
I have written a VBA macro to do some stuff in Excel, and I want to know if the following is possible.
How do I protect a Macro so that no matter who uses the spreadsheet, they cannot edit the code? The protection needs to be strong enough that even if they press ALT + F11 and pull up the macro, the Edit button options need to be greyed out, even if the macro has been selected.
Also is it possible to stop a user from even seeing the code?
Upvotes: 0
Views: 900
Reputation: 5086
I think the easiest way is just to protect the workbook code. VBA Project properties -> Protection -> Lock project for viewing. You will need to specify a password.
It's not world-class protection, but it will stop the average user editing the code.
Upvotes: 1