简体   繁体   English

如何避免在Excel中编辑宏?

[英]How to avoid the editing of a macro in Excel?

I have written a macro in Excel. 我已经在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. 说我有一个Excel工作簿sample.xls,它有一个宏按钮将工作簿保存到服务器。 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 锁定VBA项目以供查看

Open the document, template, or database that contains the VBA project you want to protect. 打开包含您要保护的VBA项目的文档,模板或数据库。 For Outlook or FrontPage, start Outlook or FrontPage on the computer that contains the VBA project you want to protect. 对于Outlook或FrontPage,请在包含要保护的VBA项目的计算机上启动Outlook或FrontPage。

Open the Visual Basic Editor. 打开Visual Basic编辑器。

In the Project Explorer, right-click the project you want to protect, and then click ProjectName Properties on the shortcut menu. 在项目资源管理器中,右键单击要保护的项目,然后在快捷菜单上单击“ ProjectName属性”。

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. 但我建议您搜索针对特定版本的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 我认为有一个链接显示了如何在MS Excel 2003中执行此操作: http : //www.ozgrid.com/VBA/protect-vba-code.htm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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