You are on page 1of 5

ENGG1811 Computing for Engineers

Configuring Excel 2007 or 2010 to use VBA


Several versions of Microsoft Excel have been released in the past few years, and students
may have access to any one of these, either 97/2000/2002/2003, 2004 (Macintosh only),
2007, 2010 or 2011 (Macintosh only). Version 2008 (Mac only) is not capable of running
VBA.
One important difference is the way that workbooks containing VBA programs or macros
are handled. Macros can be harmful, so Excel 2007 and later are especially wary of opening
workbooks that contain VBA. To follow labs 6 onwards using Excel 2007, 2010 or 2011 you
will need to configure Excel to trust the workbooks you are given (and create yourself). At
the same time, you should change the default file type to be the macro-enabled format or
the older compatible format, otherwise any programs you add to the document will be lost.
1. Differences between Excel 2007 and 2010
There are few important differences between these versions. The most obvious is that the
big Office button introduced in 2007 has been replaced by a File menu item in
2010. There are no apparent differences in the VBA editor or VBA engine.
2. File Types
From 2007 Excel adopted new file types. Prior to this the standard type was xls, the same
whether or not the workbook contained VBA. You can still save files from later versions in
this compatible format, but if you use the native formats you must be aware of the crucial
difference between the following
File type

Save-As Description

Characteristics

xlsx
xlsm
xls

Excel Workbook

workbook does not contain VBA

Excel Macro-Enabled Workbook

workbook contains VBA

Excel 97-2003 Workbook

compatible with earlier versions, can


contain VBA

Do the following once. Open Excel and click on the Office icon at the top left (Excel 2007)
or the File menu item (Excel 2010). Then press the Excel Options button or Options link
at the bottom of the window, as shown overleaf:

Configuring Excel 2007/2010 to use VBA

2007

2010

In the Save section, select from the Save files in this format list the file type Excel MacroEnabled Workbook (*.xlsm). The default file type (usually .xlsx) cannot store VBA.
2007

2010

Configuring Excel 2007/2010 to use VBA

2007

2010

In the Popular section check the Show Developer tab in the Ribbon option, as this will
ensure that you can start creating VBA later in the course.

In the Customize Ribbon section check Developer under the second column (Main Tabs)

In all versions the Developer tab on the ribbon contains a link to activate the Visual Basic
Editor, which you will need to use later.

Configuring Excel 2007/2010 to use VBA

2. Registering a Trusted Location (same for

2007

and

2010

Create a separate folder where you are going to do all your ENGG1811 work. This folder
and all its subfolders can be registered as a location where only trusted files will be placed,
and accordingly VBA code is allowed to control the application.
The settings are defined in the Trust Center section of the Excel Options panel.

Press Trust Center Settings .Select Trusted Locations and add the folder name to
the list via the Add new location button.

Leave these
unchecked

Make sure that subfolders are trusted too (arrowed checkbox).

Click OK on this dialogue box and OK the previous box.

Configuring Excel 2007/2010 to use VBA

3. Enabling Macro Notification


This allows you to open a file that contains macros even if it isnt in a trusted location, and
enable macros selectively.
Go to the Trust Center (see previous section) and select the Macro Settings section.
Pick the second option (Disable all macros with notification) and save.

Now, if you open a file containing VBA and it isnt in a trusted location, it still wont run
them by default but you get a chance to enable them. Just below the ribbon there will be a
security warning.

Press Options (Excel 2007) and select the


Enable this content option. Press OK.

For Excel 2010, press Enable Content and confirm.


The Click for more details link goes to an Info page
where you can again enable the VBA.

You might also like