Chapter 8. Using and Creating Templates

IN THIS CHAPTER

Understanding Excel templates

Working with the default templates

Creating custom templates

A template is essentially a model that serves as the basis for something else. An Excel template is a workbook that's used to create other workbooks. This chapter discusses some of the templates included with Excel and also describes how to create your own template files. Creating a template takes some time, but in the long run, doing so may save you a lot of work.

8.1. Exploring Excel Templates

The best way to become familiar with Excel template files is to jump in and try a few. Excel 2010 gives you quick access to hundreds of template files.

8.1.1. Viewing templates

To explore the Excel templates, choose File New to display the Available Templates screen in Backstage View. You can select a template stored on your hard drive, or a template from Microsoft Office Online. If you choose a template from Microsoft Office Online, you must be connected to the Internet to download it.

The Office Online Templates section contains a number of icons, which represent various categories of templates (see Figure 8.1). Click an icon, and you'll see the available templates. When you select a template thumbnail, you see a preview in the right panel.

Figure 8.1. The New page in Backstage View displays template categories.

NOTE

Microsoft Office Online has a wide variety of templates, and some are better than others. If you download a few duds, don't give up. Even though a template may not be perfect, you can often modify a template to meet your needs. Modifying an existing template is often easier than creating a workbook from scratch.

8.1.2. Creating a workbook from a template

To create a workbook based on a template, just locate the template and click the Create button on the right. If the template is on Microsoft Office Online, the Create button is replaced with a Download button.

What you do next depends on the template. Every template is different, but most are self-explanatory. Some workbooks require customization. Just replace the generic information with your own information.

Figure 8.2 shows a workbook based on an invoice template. This particular workbook has a few simple formulas that perform calculations using the data that you enter. Figure 8.3 shows the workbook after it has been customized a bit, and some items added. Notice that formulas calculate the subtotal, sales tax, and total.

NOTE

It's important to understand that you're not working with the template file. Rather, you're working with a workbook that was created from the template file. If you make any changes, you're not changing the template — you're changing the workbook that's based on the template. After you download a template from Microsoft Office Online, that template is available in the My Templates category (in the Available Templates screen) so you don't need to redownload it if you want to re-use the template.

Figure 8.2. A workbook created from an invoice template downloaded from Microsoft Office Online.

If you want to save the workbook, click the Save button. Excel proposes a named based on the template's name, but you can use any name you like.

Figure 8.3. The workbook, after customizing it and entering some information.

8.1.3. Modifying a template

A template file is just like a workbook file. As such, you can open a template file, make changes to it, and then resave the template file. Looking at the invoice template shown earlier in this chapter, you may want to modify it so that it shows your company information and uses your actual sales tax rate. Then, when you use that template in the future, the workbook created from it will already be customized.

To open a template, choose File Open (not File New) and locate the template file (it will have an .xltx or .xlt extension).

The location for template files varies. To find out where Excel stores template files, open a new workbook and choose File Save As. In the Save As dialog box, choose Excel Template (*.xltx) from the Save as Type drop-down list. Excel will activate your template folder. Make a note of this location, and click Cancel to close the Save As dialog box. On my system, templates are stored here:


C:Users<username>AppDataRoamingMicrosoftTemplates

When you open a XLST (or *.XLT) template file, you are opening the actual file — you are not creating a workbook from the template file.

NOTE

To create a workbook from a modified template, you must select the template from the My Templates icon in the Available Template screen. Clicking My Templates displays the New dialog box shown in Figure 8.4. Just select the template and click OK.

Figure 8.4. The New dialog box displays downloaded and custom templates stored on your hard drive.

8.2. Understanding Custom Excel Templates

So far, this chapter has focused on templates that were created by others. The remainder of the chapter deals with custom templates — templates that you create.

Why create custom templates? The main reason is to make your job easier. For example, you may always like to use a particular header or footer on your printouts. Consequently, the first time that you print a worksheet, you need to spend time entering the header and footer information. Although it isn't a lot of work, wouldn't it be easier if Excel simply remembered your favorite page settings and used them automatically?

The solution is to modify the template that Excel uses to create new workbooks. In this case, the modification consists of inserting your header into the template. Save the template file using a special name, and then every new workbook that you create (including the workbook created when Excel starts) has your customized page settings.

Excel supports three types of templates, which I discuss in the following sections:

  • The default workbook template: Used as the basis for new workbooks.

  • The default worksheet template: Used as the basis for new worksheets inserted into a workbook.

  • Custom workbook templates: Usually, these ready-to-run workbooks include formulas, but they can be as simple or as complex as you like. Typically, these templates are set up so that a user can simply plug in values and get immediate results. The Microsoft Office Online templates (discussed earlier in this chapter) are examples of this type of template.

8.2.1. Working with the default templates

The term default template may be a little misleading. If you haven't created your own template files to control the default settings, Excel uses its own internal settings — not an actual template file. In other words, Excel uses your template files to set the defaults for new workbooks or worksheets, if these files exist. But if you haven't created these files, Excel is perfectly happy to use its own settings.

8.2.1.1. Using the workbook template to change workbook defaults

Every new workbook that you create starts out with some default settings. For example, the workbook has three worksheets, the worksheets have gridlines, the page header and footer are blank, and text appears in the fonts specified by the default document template. Columns are 8.43 units wide, and so on. If you're not happy with any of the default workbook settings, you can change them by creating a workbook template.

Making changes to Excel's default workbook is fairly easy to do, and it can save you lots of time in the long run. Here's how you change Excel's workbook defaults:

  1. Open a new workbook.

  2. Add or delete sheets to give the workbook the number of worksheets that you want.

  3. Make any other changes that you want to make, which can include column widths, named styles, page setup options, and many of the settings that are available in the Excel Options dialog box. To change the default formatting for cells, choose Home Styles Cell Styles and then modify the settings for the Normal style. For example, you can change the default font, size, or number format.

  4. When your workbook is set up to your liking, choose File Save As.

  5. In the Save As dialog box, select Excel Template (*.xltx) from the Save As Type list. If your template contains any VBA macros, select Excel Macro-Enabled Template (*.xltm).

  6. Enter book for the filename.

    Excel will offer a name, such as Book1.xlt. You must change this name to book.xlt (or book.xltm) if you want Excel to use your template to set the workbook defaults.


  7. Save the file in your XLStart folder (not in your Templates folder).

    The location of the XLStart folder varies, but it is probably located here:


    C:Program FilesMicrosoft OfficeOffice14XLStart

  8. Close the file.

    After you perform the preceding steps, the new default workbook is based on the book.xltx (or book.xltm) workbook template. You can create a workbook based on your template by using any of these methods:

    • Press Ctrl+N.

    • Open Excel without first selecting a workbook to open.

NOTE

For some reason, the book.xltx template is not used if you choose File New and choose Blank Workbook. That command results in a default workbook. I'm not sure whether this is a bug or whether it's by design. In any case, it provides a way to override the custom book.xltx template if you need to.

If you insert a new worksheet into a workbook that's based on the book.xlxt template, the new worksheet will not use any customized worksheet settings specified in the template (for example, a different column width). Therefore, you may also want to create a sheet.xltx template (described in the next section), which controls the settings for new worksheets.


If you ever want to revert to the standard default workbook, just delete the book.xltx file.

8.2.1.2. Using the worksheet template to change worksheet defaults

When you insert a new worksheet into a workbook, Excel uses its built-in worksheet defaults for the worksheet. These default settings include items such as column width, row height, and so on.

If you don't like the default settings for a new worksheet, you can change them by following these steps:

  1. Start with a new workbook and delete all the sheets except one.

  2. Make any changes that you want to make, which can include column widths, named styles, page setup options, and many settings available in the Excel Options dialog box.

  3. When your workbook is set up to your liking, choose File Save As.

  4. In the Save As dialog box, select Template (*.xltx) from the Save As Type list.

  5. Enter sheet.xltx for the filename.

  6. Save the file in your XLStart folder (not in your Templates folder).

  7. Close the file.

  8. Close and restart Excel.

After performing these steps, all new worksheets that you insert by using any of these methods will be formatted like your sheet.xltx template:

  • Click the Insert Worksheet button (next to the last sheet tab).

  • Choose Home Cells Insert Insert Sheet.

  • Press Shift+F11.

  • Right-click a sheet tab, choose Insert from the shortcut menu, and choose the Worksheet icon in the Insert dialog box.

8.2.1.3. Editing your templates

After you create your book.xltx or sheet.xltx templates, you may discover that you need to change them. You can open the template files and edit them just like any other workbook. After you make your changes, save the file to its original location, and close it.

8.2.1.4. Resetting the default workbook and worksheet settings

If you create a book.xltx or sheet.xltx file and then decide that you would rather use the standard default settings, simply delete the book.xltx or sheet.xltx template file — depending on whether you want to use the standard workbook or worksheet defaults — from the XLStart folder. Excel then uses its built-in default settings for new workbooks or worksheets.

You can also rename or move the template files if you'd like to keep them for future use.


8.2.2. Creating custom templates

The book.xltx and sheet.xltx templates discussed in the preceding section are two special types of templates that determine default settings for new workbooks and new worksheets. This section discusses other types of templates, referred to as workbook templates, which are simply workbooks that you set up as the basis for new workbooks or worksheets.

Creating a workbook template can eliminate repeating work. Assume that you create a monthly sales report that consists of your company's sales by region, plus several summary calculations and charts. You can create a template file that consists of everything except the input values. Then, when it's time to create your report, you can open a workbook based on the template, fill in the blanks, and be finished.

NOTE

You could, of course, just use the previous month's workbook and save it with a different name. This is prone to errors, however, because you easily can forget to use the Save As command and accidentally overwrite the previous month's file. Another option is to use File New, and choose the New from Existing option in the Available Templates screen. This command creates a new workbook from an existing one, but gives a different name to ensure that the old file is not overwritten.

When you create a workbook that's based on a template, the default workbook name is the template name with a number appended. For example, if you create a new workbook based on a template named Sales Report.xltx, the workbook's default name is Sales Report1.xlsx. The first time that you save a workbook that is created from a template, Excel displays its Save As dialog box so that you can give the template a new name if you want to.

A custom template is essentially a normal workbook, and it can use any Excel feature, such as charts, formulas, and macros. Usually, a template is set up so that the user can enter values and get immediate results. In other words, most templates include everything but the data, which is entered by the user.

NOTE

If your template contains macros, it must be saved as an Excel Macro-Enabled Template, with an XLTM extension.

Locking Formula Cells in a Template File

If novices will use the template, you might consider locking all the formula cells to make sure that the formulas aren't deleted or modified. By default, all cells are locked and cannot be changed when the worksheet is protected. The following steps describe how to unlock the nonformula cells:

  1. Choose Home Editing Find & Select Go to Special to display the Go To Special dialog box.

  2. Select Constants and click OK. This step selects all nonformula cells.

  3. Press Ctrl+1 to display the Format Cells dialog box.

  4. In the Format Cells dialog box, click the Protection tab.

  5. Remove the check mark from the Locked check box.

  6. Click OK to close the Format Cells dialog box.

  7. Choose Review Changes Protect Sheet to display the Protect Sheet dialog box.

  8. Specify a password (optional) and then click OK.

After you perform these steps, you can't modify the formula cells — unless the sheet is unprotected.


8.2.2.1. Saving your custom templates

To save a workbook as a template, choose File Save As and select Template (*.xltx) from the Save as Type drop-down list. If the workbook contains any VBA macros, select Excel Macro-Enabled Template (*.xltm). Save the template in your Templates folder — which Excel automatically suggests — or a folder within that Templates folder.

If you later discover that you want to modify the template, choose File Open to open and edit the template.

8.2.2.2. Ideas for creating templates

This section provides a few ideas that may spark your imagination for creating templates. The following is a partial list of the settings that you can adjust and use in your custom templates:

  • Multiple formatted worksheets: You can, for example, create a workbook template that has two worksheets — one formatted to print in landscape mode and one formatted to print in portrait mode.

  • Style: The best approach is to choose Home Styles Cell Styles and modify the attributes of the Normal style. For example, you can change the font or size, the alignment, and so on.

  • Custom number formats: If you create number formats that you use frequently, you can store them in a template.

  • Column widths and row heights: You may prefer that columns be wider or narrower, or you may want the rows to be taller.

  • Print settings: Change these settings in the Page Layout tab. You can adjust the page orientation, paper size, margins, and several other attributes.

  • Header and footer: You enter custom headers or footers in Page Layout view (choose View Workbook Views Page Layout).

  • Sheet settings: These options are in the Show group on the View tab, and also on the Advanced tab of the Excel Options dialog box (in the Display Options for This Worksheet section). Options include row and column header, page break display, gridlines, and others.

You can, of course, also create complete workbooks and save them as templates. For example, if you frequently need to produce a specific report, you may want to create a template that has everything for the report except for the data you need to enter. By saving your master copy as a template, you're less likely to overwrite the original file when you save the file after entering your data.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset