views:

82

answers:

1

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. (IF they press ALT F11 and pull up the macro 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?

+1  A: 

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.

Joel Goodwin