官术网_书友最值得收藏!

Using the Trust Center for macro security

This recipe is all about security, at least as far as macros are concerned. We will show you where to find the Trust Center in Excel, and after that, how to choose between four levels of macro security.

Getting ready

We've successfully created and tested our macro. We've even made some changes to the code by editing it in the VBA Editor. The final step is to have 02_RecordMacro.xlsm open in order to set the macro security.

How to do it…

Proceed with the following steps for this recipe:

  1. Activate the backstage view by clicking on File:

    Figure 1.23 – The backstage view

  2. From the category list on the left, select the last one, Options. The Excel Options dialog box appears:

    Figure 1.24 – The Excel Options dialog box

  3. Select the last category on the left, Trust Center, and then click on the Trust Center Settings button on the right:

    Figure 1.25 – Macro Settings in the Trust Center dialog box

  4. Select the Macro Settings category on the left. The details will be displayed on the right.
  5. Click the second radio button from the top, Disable all macros with notification.
  6. Click on OK to close the Trust Center dialog box.
  7. In the Excel Options dialog box, click on OK.

How it works…

Macro Settings has four levels of security in order to prevent viruses from entering your system. These options are as follows:

  • Disable all macros without notification: Choosing this option will enable all macros. It is safe but defeats the purpose of creating macros.
  • Disable all macros with notification: This is the standard setting, selected by most users. A yellow message bar will appear when you open a file with an embedded macro. If you know and trust the person that sent the file, go ahead and disable the macros. If not, do not enable the macros.
  • Disable all macros except digitally signed macros: Only macros that have a digital signature are allowed to run. However, you will still receive a security warning for signatures that haven't been marked as trusted.
  • Enable all macros: This setting is not recommended because potentially dangerous code can run. Unless you are not connected to the internet, or any other computers in a LAN, never choose this option.

There's more…

The keyword here is vigilance. In this day and age, computer security is vital. A good starting point would be to always have an anti-virus application running on your PC. It is better to be safe than sorry.

主站蜘蛛池模板: 拉萨市| 保靖县| 苏尼特右旗| 谷城县| 南澳县| 南宁市| 社旗县| 延津县| 锡林浩特市| 广宁县| 玉屏| 西华县| 定兴县| 方城县| 思茅市| 临西县| 利辛县| 苍溪县| 中宁县| 山东| 堆龙德庆县| 康保县| 浦东新区| 海伦市| 佛学| 荃湾区| 廊坊市| 于田县| 丹棱县| 乐都县| 襄城县| 广东省| 酉阳| 祁阳县| 扎鲁特旗| 韩城市| 昭苏县| 长沙市| 石楼县| 济源市| 中江县|