简体   繁体   中英

Macro Edit/View Protection

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM