简体   繁体   中英

How to avoid the editing of a macro in Excel?

I have written a macro in Excel. When I send it to some user, he should not be able to see the macro.

Say I have a Excel workbook sample.xls, and it has a macro button to save the workbook to the server. When some other user opens the workbook, he should not be able to edit the macro behind that button.

How do I block other users from editing the code?

To lock a VBA project for viewing

Open the document, template, or database that contains the VBA project you want to protect. For Outlook or FrontPage, start Outlook or FrontPage on the computer that contains the VBA project you want to protect.

Open the Visual Basic Editor.

In the Project Explorer, right-click the project you want to protect, and then click ProjectName Properties on the shortcut menu.

On the Protection tab, select the Lock project for viewing check box, enter and confirm the password, and then click OK.

You can password protect it. But I'd suggest you search how to do it for your specific version of MS Excel. There is a link which shows how to do it in MS Excel 2003, I think: http://www.ozgrid.com/VBA/protect-vba-code.htm

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