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

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.

主站蜘蛛池模板: 子洲县| 黄浦区| 五台县| 佛坪县| 抚远县| 饶平县| 岐山县| 玉田县| 湖州市| 徐闻县| 海丰县| 博罗县| 无棣县| 平阴县| 华容县| 北碚区| 蕉岭县| 临汾市| 淳化县| 兴隆县| 汉沽区| 湟源县| 贵阳市| 当阳市| 闻喜县| 开江县| 和静县| 玉山县| 砚山县| 高唐县| 甘谷县| 太康县| 呼和浩特市| 应城市| 高碑店市| 西安市| 万载县| 响水县| 龙州县| 扶余县| 柳江县|