Читать книгу Excel VBA Programming For Dummies - Dick Kusleika - Страница 38
Understanding Macro Security
ОглавлениеMacro security is a key feature in Excel. The reason is that VBA is a powerful language — so powerful that it’s possible to create a macro that can do serious damage to your computer. A macro can delete files, send information to other computers, and even destroy Windows so that you can’t start your system.
Figure 2-6 shows the Macro Settings section of the Trust Center dialog box. To display this dialog box, choose Developer ⇒ Code ⇒ Macro Security.
FIGURE 2-6: The Macro Settings section of the Trust Center dialog box.
By default, Excel uses the Disable All Macros with Notification option. With this setting in effect, if you open a workbook that contains macros (and the file is not digitally “signed” or stored in a trusted location), Excel displays a warning like the one shown in Figure 2-7. If you are certain that the workbook comes from a trusted source, click Enable Macros, and Excel enables the macros.
FIGURE 2-7: Excel’s warning that the file to be opened contains macros.
You see the pop-up box in Figure 2-7 only when the VBE is open. Otherwise, Excel displays an eye-catching Security Warning above the Formula bar, as shown in Figure 2-8. If you know the workbook is safe, click the Enable Content button to enable the macros. To use the workbook without macros, click the X to dismiss the warning.
Excel remembers when you designate a workbook to be safe. So the next time you open the workbook, you won’t see the Security Warning.
FIGURE 2-8: Excel's warning that the workbook just opened contains macros. You see this warning when the VBE isn’t open.
Perhaps the best way to handle macro security is to designate one or more folders as trusted locations. All the workbooks in a trusted location are opened without a macro warning. You designate trusted folders in the Trusted Locations section of the Trust Center dialog box.
If you want to find out what the other macro security settings mean, press F1 while the Macro Settings section of the Trust Center dialog box is in view and review the Help screen that appears.