Microsoft Office 2000/Visual Basic Programmer's Guide   

Deploying a Custom Template

When you create a new document in Word, Excel, or PowerPoint, the New dialog box (File menu) displays a list of templates that you can choose from to create a new document. The dialog box can display three types of templates: built-in templates that are included with Office 2000; user-created templates, which are stored on users' computers; and workgroup templates, which are stored on a network share. Only templates from certain folders are displayed, however, so if you create a new template, you must save it to the correct location in order for it to be displayed in the dialog box. The following table indicates where the dialog box looks for each type of template.

Type of template Default location Notes
Built-in C:\Program Files
\Microsoft Office\Templates
\LanguageID
The language ID is a number indicating the product language. For U.S. English, this is 1033. User-created templates saved here will not appear in the New dialog box.
User-created C:\Windows\Application Data
\Microsoft\Templates

-or-

C:\Windows\Profiles\UserName
\Application Data\Microsoft
\Templates

You can change this location in Word or Excel in the Options dialog box (Tools menu). In order to appear in the New dialog box, user-created templates must be stored in the location that's specified in the Options dialog box.
Workgroup Not specified You can specify a location for workgroup templates in the Options dialog box in Word, or from VBA code in Excel or Word. When you set this option, templates in the specified location appear in the New dialog box.

As you can see, you have two options for installing a custom template: You can install it locally on users' machines, or you can copy it to a shared folder on a network server.

Installing a Custom Template Locally

To install a custom template locally onto users' machines, you have a couple of options:

Deploying a Workgroup Template to a Network Share

If you need to deploy a custom template to multiple users, a good way to do it is to copy the template to a shared folder on a network server, so that it is available to everyone who has access to the share.

Once you've copied the template to the shared folder, you need to make sure that every user has specified this path for workgroup templates. Word and Excel both provide an option to specify a path for workgroup templates. You or users can set this option to point to the shared folder for each user's application.

There are several ways to set the workgroup templates option:

In Word, you can modify the workgroup templates option through VBA code by setting the DefaultFilePath property of the Options object, passing in the wdWorkgroupTemplatesPath constant for the path argument, as shown in the following code fragment:

Options.DefaultFilePath(wdWorkgroupTemplatesPath) = "\\Server\Share\WorkgroupTemplates"

In Excel, you can modify the workgroup templates option through VBA code by setting the NetworkTemplatesPath property of the Application object:

Application.NetworkTemplatesPath = "\\Server\Share\WorkgroupTemplates"

For example, if you have Visual Basic, you can write a simple program that launches Word or Excel through Automation to set this option, and then compile the program into an .exe file and distribute it to all of your users through e-mail. When the users run the program, it will set the workgroup templates option correctly for them.

Storing a workgroup template on a common network share is a good idea from a maintenance standpoint, because you can modify the template without having to redistribute the template to every user. However, if you need to deploy the template to users who do not have access to a common network share, you can build a custom installation program to deploy a template. See the following section for more information.