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

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.

主站蜘蛛池模板: 治多县| 巴塘县| 红原县| 中江县| 津南区| 宁乡县| 土默特右旗| 阜宁县| 五峰| 襄樊市| 河北省| 札达县| 凌源市| 保靖县| 阳山县| 香河县| 陈巴尔虎旗| 崇信县| 榆社县| 平顶山市| 县级市| 徐汇区| 集贤县| 海门市| 香河县| 拉孜县| 宁安市| 海丰县| 太康县| 泉州市| 南安市| 裕民县| 山阳县| 邵阳市| 上犹县| 黔西| 那曲县| 西昌市| 凉山| 鄄城县| 昌黎县|