Save Macros

When we work with macros, we need to know where we can save them so that we can use them later. For this simple reason, a macro must be open in order to use it. When we record a macro, it asks us where we want to save the macro:

1. In a personal macro workbook
2. In a new workbook
3. In this workbook

les04_image001_en

Knowing that the macro must be open before you can use it, you can open the file where you record the macro, if you choose “This Workbook”.

If you wish the macro to always run from a new workbook, choose the “New Workbook” option.

If you wish that the macro is performed only when you are in your personal collection of workbooks, than choose “Personal Macro Workbook”. The “Personal Macro Workbook” contains every file that opens when you start Excel.

When you save a macro in “Personal Macro Workbook”, Excel automatically saves the file as PERSONAL.XLSB. This file is created when you first store a macro and it automatically (and invisibly) loads at startup of Excel.

If you wish to use a macro in all the files you open, you must save it in your Personal Macro Workbook.

In case you make a macro that you just want to use in the directory you’re working with then you should choose “This workbook”.

And if you have a macro that you wish to apply to each new workbook, such as inserting today’s date, then you use “New Workbook”.

Macro Security

When you work with macros and VBA code, and especially when you receive files from third parties with Macros and VBA code, it is important to set up “Macro Security” properly. In the 2010 version and 2007 we find this option in the Ribbon, under the “Developer” tab.

les04_image002_en
When you click the option, open the dialog “Trust Center” where the “Macro Settings” tab is selected. Under this tab, the default option “Disable all macros with notification” is selected. I recommend this setting. Choosing the first option, “Disable all macros without notification,” you may never detect if there is a macro somewhere in the file you use (e.g. shared file). If you choose the last option “Enable all macros”, then the possibility exists that viruses infect your computer through the VBA code.

les04_image003_en

For Excel 2003 and earlier versions, choose the Tools menu and click “Options.”
Choose the “Security” tab and click “Macro Security”.

les04_image005_en

This opens the dialog box “Security”. Choose the “Security” tab and select “Medium” and click OK.

les04_image004_en

Awesome!
You've completed Lesson 4
START NEXT LESSON