Chapter Ten - Templates and Macors

Exploring Microsoft
Office Excel 2007
Chapter 10
Templates, Styles, Web,
and Macros
Robert Grauer, Keith Mulbery, Judy Scheeren
Copyright
© 2008 Pearson
Prentice Hall.
AllNext
rights Generation
Committed
to
Shaping
the
Copyright
2008
Pearson
Prentice Hall.
rightsreserved.
reserved.
Copyright© ©
2008
Prentice-Hall.
reserved.
All All
rights
of IT Experts.
1
Objectives









Work with existing templates, themes, and styles
Create and apply custom styles for advanced
formatting
Create and use a template
Create a Web page
Create Web queries
Create a macro with the Macro Recorder
Create macro buttons
Work with macro security
Understand the basics of VBA
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
2
Work with Existing Templates,
Themes, and Styles

A template





A partially completed workbook that is used as a model to
create other workbooks that have the same structure and
purpose
Typically contains formulas and formatting but no data or
only sample data
Helps ensure consistency and standardization for similar
workbooks
Resides in a special folder so the latest templates are
available for you to use
Uses a different file extension (.xltx) than a regular Excel
workbook (.xlsx)
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
3
Work with Existing Templates,
Themes and Styles
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
4
Work with Existing Templates,
Themes and Styles

A document theme is a defined set of colors,
fonts, lines, and fill effects applied to an entire
workbook or to specific items in a workbook

Themes are prepackaged combinations of fonts,
colors, and effects that can be applied to a
worksheet

Apply themes to existing worksheets that use
Themed Cell styles
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
5
Work with Existing Templates,
Themes, and Styles
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
6
Work with Existing Templates,
Themes, and Styles

A background is an image placed behind the
worksheet data

A style is a set of formatting options applied
to cells
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
7
Create and Apply Custom Styles for
Advanced Formatting





Create a custom style that can be used in all your
Excel workbooks
Base it on the formatting already in an existing cell
The custom style you create will appear in the
Custom section of the Cell Styles palette
To modify a style, right-click it in the Custom section
of the Cell Styles palette, and select Modify
To delete a style, right-click on the Style in the
Custom section of the Cell Styles palette and select
Delete
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
8
Create and Apply Custom Styles for
Advanced Formatting
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
9
Create and Use a Template


You may need to create a template that meets your
exact requirements
When creating a template, considerations include:







A template should be a blank form
Create formulas so they will not change
Use appropriate function to trap errors
Include instructions
Turn off worksheet gridlines
Apply appropriate formatting
Give worksheets meaningful names; delete worksheets
that are not used
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
10
Create and Use a Template
A
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
11
Create and Use a Template



Most templates are based on protected
worksheets that enable users to change only a
limited number of cells on the worksheet
Protecting worksheets prevents modification of
formulas and text but enables you to change
values in unprotected cells
Protecting worksheets involves two steps:


First, unlock the cells that can be changed
Second, protect the worksheet
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
12
Create a Web Page




Use the Save As option to save an Excel
workbook as a Web page
Use hyperlinks and graphics to make it more
effective
Preview it in the browser to see how it will
look on the Internet
Hyperlinks are links in an application or Web
page
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
13
Create a Web Page


Hyperlinks are links in an application or Web
page
Three basic purposes:




To display another Web page
To display a different application file, such as a
Word file
To display another worksheet or different location
on a large worksheet in Excel
Can modify and/or delete hyperlinks
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
14
Create a Web Page


Inserting pictures or photographs to highlight
or embellish a spreadsheet
To insert a picture in a worksheet:



Click Picture in the Illustrations group on the Insert
tab
Select the location of the picture and the picture to
be inserted in the Insert Picture dialog box
Click Insert
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
15
Inserting a Picture
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
16
Create a Web Page



SmartArt, a new feature in Excel 2007, is a
graphic organizer diagram that visually
presents information to communicate a
message
Use caution; the graphics are relatively
generic and will not always enhance the
information value of a workbook
The Reference Table shows the SmartArt
categories and descriptions
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
17
Create a Web Page
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
18
Create a Web Page




Format a worksheet for the Web
Simplicity should be the watchword for a
Web page
Watch color and font combinations
Use graphics sparingly; too many graphics
will be cause for long download times


.GIF files will download quicker than .JPEG files
Use the Save As option to save the document
as a Web page
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
19
Create a Web Query





A Web query enables Excel to go to a particular
Web site to obtain the Web based information
Web queries let you extract data from tables on
a Web page
If the Web address changes, you must change
the Web query and URL to ensure you have the
most accurate information and citation
The information downloaded is based on the
structure of the Web page
If you have to log in to the Web site, the query
generally will not work
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
20
Create a Web Query
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
21
Macros and VBA

A macro is a set of instructions that tells
Excel which commands to execute

Visual Basic a programming language used
to create macros

You do not have to be a programmer to write
macros
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
22
Create a Macro with the Macro
Recorder



Comments provide information about the
macro, but do not affect its execution and are
considered documentation
To use the recorder, click the Macros down
arrow in the Macros group and select Record
Macros
From that point until you stop recording,
every command you execute will be stored by
the recorder
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
23
Create a Macro with the Macro
Recorder

Excel has two other file formats that store
macros:


XLSM files, which are macro enabled workbooks,
are stored using XML
XLSB files, which are workbooks stored in binary
format, are often used for very large
spreadsheets
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
24
Create a Macro with the Macro
Recorder

The Macro Recorder has some issues:




Everything you do once you begin recording a
macro becomes part of the macro
Take your time and be sure the action is correct
Try to ensure your macros are broad enough to
apply to a variety of situations
The Visual Basic Editor (VBE) is used to
create, edit, execute, and debug Excel
macros
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
25
Create a Macro with the Macro
Recorder
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
26
Create a Macro with the Macro
Recorder
To create a macro:
1. Click Record Macro in the Macros down arrow in the
Macros group of the View tab to open the Record
Macro dialog box
2. Type a name for the macro in the Macro name text
box
3. Create a keyboard shortcut, if desired, for your
macro in the Shortcut key box
4. Select a location to store the macro from the Store
macro in drop-down arrow
5. Click OK to start recording the Macro
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
27
Create a Macro with the Macro
Recorder
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
28
Create Macro Buttons


May prefer to have a button on the Quick
Access Toolbar
Requires that the Developer tab is added to
the Ribbon first


To place the Developer tab on the ribbon, click the
Microsoft Office button and click Excel Options
Choose the Popular section and check Show
Developer tab on the Ribbon
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
29
Work with Macro Security



The proliferation of Excel macro viruses has
made it a dangerous operation to open
spreadsheets that contain viruses
To counter this threat, when you open an
Excel workbook that contains macros, Excel
automatically disables the macros and
displays the Security Warning Macros have
been disabled message
Click Options to open the Microsoft Office
Security Options dialog box
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
30
Work with Macro Security
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
31
Understand the basics of VBA




Starting with Office 95, the recorded
keystrokes of a macro were translated into
Visual Basic commands
Can execute Visual Basic programs from
within Excel
Microsoft Office uses a subset of Visual Basic
known as Visual Basic for Applications (VBA)
You are not expected to be a programmer,
but you do need to know the capabilities of
VBA and its relationship with Excel
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
32
Copyright © 2008 Pearson Prentice Hall. All rights reserved.
33