excel 宏隐藏分页表_隐藏Excel宏

excel 宏隐藏分页表

When you add a macro to an Excel workbook, users can see that macro in a list when they choose Tools|Macro|Macros.

当您将宏添加到Excel工作簿时,用户选择“工具” |“宏” |“宏”可以在列表中看到该宏。

In some workbooks, you might want to hide one or more of your macros, to prevent users from running them.

在某些工作簿中,您可能希望隐藏一个或多个宏,以防止用户运行它们。

Note: This technique won't add any protection to your code, it will simply remove the macro from the list, so casual users won't accidentally or intentionally run it.

注意:此技术不会对您的代码添加任何保护,它只会从列表中删除该宏,因此临时用户不会意外或有意运行它。

将宏设为私有 (Make the Macro Private)

In this example, I have two macros – one that the users can run, and one that I'd prefer to keep hidden. Here's the code:

在此示例中,我有两个宏–一个用户可以运行的宏,另一个我希望保持隐藏的宏。 这是代码:

If I add the word Private at the start of the Sub MySecretMacro line, that macro won't be included in the macro list.

如果在Sub MySecretMacro行的开头添加单词Private ,则该宏将不会包含在宏列表中。

Now only the MyVisibleMacro appears in the list.

现在,只有MyVisibleMacro出现在列表中。

运行隐藏的宏 (Run the Hidden Macro)

Now that you've hidden the macro, so casual users won't find it, how can you run it yourself? Here are a few ways you can run it

现在,您已经隐藏了宏,因此临时用户将找不到它,那么如何自己运行它? 您可以通过以下几种方式运行它

  • Open the Visual Basic Editor (Alt+F11), click somewhere in the macro's code, then click the Run button.

    打开Visual Basic编辑器(Alt + F11),单击宏代码中的某个位置,然后单击“运行”按钮。

OR

要么

  • If you know the name of the macro, type it in the Name Box, at the left of the Formula bar.

    如果您知道宏的名称,请在“公式”栏左侧的“名称框”中键入它。
  • Press the Enter key, and the Visual Basic Editor will open automatically, with the cursor flashing in the macro's code

    按Enter键,Visual Basic编辑器将自动打开,光标在宏的代码中闪烁
  • Click the Run button.

    单击运行按钮。

OR

要么

  • Before you hide the macro, choose Tools|Macro|Macros, select the macro, and click the Options button

    隐藏宏之前,选择“工具” |“宏” |“宏”,选择宏,然后单击“选项”按钮
  • Type a keyboard shortcut (Ctrl + Shift + M in this example) then click OK

    键入键盘快捷键(在本示例中为Ctrl + Shift + M),然后单击“确定”。

  • Close the Macro dialog box.

    关闭宏对话框。
  • Add Private to the macro code, then use your keyboard shortcut to run it when required.

    将“专用”添加到宏代码,然后在需要时使用键盘快捷键运行它。

翻译自: https://contexturesblog.com/archives/2009/01/12/hide-an-excel-macro/

excel 宏隐藏分页表

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值