Security settings can be set
for all workbooks or for specific, trusted locations. Workbooks stored
in a folder that is marked as a trusted location will automatically have
its macros enabled.
Macro settings are found under File, Options, Trust
Center, Trust Center Settings, Macro Settings. The four macro setting
options are
Disable All Macros Without Notification— Prevents all macros from running. With this setting, only macros in the Trusted Locations folders can run.
Disable All Macros with Notification—
The recommended setting. A message is displayed in the Message Area
that macros have been disabled. You can choose to enable the content by
clicking that option, as shown in Figure 1.
Disable All Macros Except Digitally Signed Macros—
Requires you to obtain a digital signing tool from VeriSign or another
provider. Appropriate if you are going to be selling add-ins to others,
but a bit of a hassle if you just want to write macros for your own use.
Enable All Macros (Not Recommended: Potentially Dangerous Code Can Run)— Although
this option requires the least amount of hassle, it opens your computer
to attacks from malicious Melissa-like viruses. Microsoft suggests that
you do not use this setting.
The recommended macro setting is Disable All Content
with Notification. With this setting, if you open a workbook that
contains macros, you’ll see a Security Warning in the area just above
the formula bar, as shown in Figure 13.1. Assuming you were expecting macros in this workbook, click Enable Content.
If you do not want to enable macros for the current
workbook, dismiss the Security Warning by clicking the X at the far
right of the message bar.
If you forget to enable the macros and attempt to run
a macro, a message informs you that you cannot run the macro because
all macros have been disabled. You will need to close the workbook and
reopen it to access the message bar again and enable the macros.
After you enable macros for a workbook stored on a
local hard drive and then save the workbook, Excel will remember that
you previously enabled macros in this workbook. The next time you open
this workbook, macros will be automatically enabled.
Developer Tab
By
default, the Developer tab is hidden in Excel. The Developer tab
contains useful tools, such as buttons for recording macros and adding
controls to sheets. To access it, do the following:
1. | Go to File, Options, Customize Ribbon.
|
2. | In the right list box, select the Developer tab, which is near from the bottom.
|
3. | Click OK to return to Excel. Excel displays the Developer tab shown in Figure 2.
|
The buttons in the Code group on the Developer tab are used for recording and playing back macros:
Visual Basic— Opens the Visual Basic Editor (VB Editor or VBE).
Macros— Displays the Macro dialog, where you can choose to run or edit a macro from the list of macros.
Record Macro— Begins the process of recording a macro.
Use Relative Reference—
Toggles between using relative or absolute recording. With relative
recording, Excel will record that you move down three cells. With
absolute recording, Excel will record that you selected cell A4.
Macro Security— Shortcut to access the Trust Center, where you can choose to allow or disallow macros to run on this computer.