Understanding Macro Security for Excel 2016 VBA Programming - dummies

Understanding Macro Security for Excel 2016 VBA Programming

By John Walkenbach

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 even start your system.

The macro security features introduced in Excel 2007 were created to help prevent these types of problems.

Check out the Macro Settings section of the Trust Center dialog box. To display this dialog box, choose Developer  →  Code  →  Macro Security.

The Macro Settings section of the Trust Center dialog box.
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. If you are certain that the workbook comes from a trusted source, click Enable Macros, and the macros will be enabled.

Excel’s warning that the file to be opened contains macros.
Excel’s warning that the file to be opened contains macros.

You see the pop-up box only if the VBE is open. Otherwise, Excel displays an eye-catching Security Warning above the Formula bar. 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’s warning that the workbook just opened contains macros. You see this warning if the VB
Excel’s warning that the workbook just opened contains macros. You see this warning if the VBE is not open.

Excel will remember if you’ve designated a workbook to be safe. So the next time you open it, you won’t see the Security Warning.

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 imply, press F1 while the Macro Settings section of the Trust Center dialog box is in view. You’ll get a Help screen that describes the security settings.