| Applies to |
| Microsoft Office Visio® 2003 |
 |
This article was excerpted from Microsoft® Office Visio® 2003 Inside Out by Mark H. Walker and Nanette Eaton, Chapter 21, "Customizing Shapes and Solutions." Visit Microsoft Learning to buy this book. |
If you want to know what goes on behind the scenes when you work with Visio shapes, this section is for you. This information is useful primarily if you plan to create new shapes and save them for reuse as master shapes. Each master has an internal timestamp that records the date and time it was last updated. When you drag a master onto the drawing page, Visio uses its timestamp to determine whether to make a copy of the master on the document stencil. An instance or copy of the master appears on the drawing page, as Figure 1 shows. A drawing file always includes a document stencil that contains copies of the masters used in the drawing, even if the corresponding shapes are later deleted from the drawing page. An instance on the drawing page is linked to the copy of the master on the local stencil and inherits its behavior and appearance from that master. If you create a shape using the drawing tools, the shape is not linked to any master or the document stencil.

Figure 1. When you drag a shape from a stencil onto the drawing page, Visio places a copy of the master on the document stencil.
Inheritance is a weird fact of Visio life that keeps file management efficient and makes shapes reusable. Because of inheritance, you can quickly reformat all the instances of a master shape that you've already added to a drawing page by editing the copy of the master shape on the document stencil. You can also share shapes with other Visio users and know that the shape will look right on the other user's computer. Inheritance also explains why when you ungroup a shape created from a master, a dire-sounding message appears: "This action will sever the object's link to its master." This simply means that the shape on the page will no longer inherit from the master stored on the document stencil — that is, the shape is no longer an instance of the master. That severed master, however, remains on the document stencil. Only the link to the master has been removed.
To remove masters from a document stencil that are no longer linked to shapes on the page, you can display the document stencil and delete them manually. You can't tell by looking whether a master on the document stencil is linked to a shape instance on the drawing page, but if you try to delete a master that is still linked, you see the message shown in Figure 2. About the only time it's worth cleaning up a document stencil is if you're intending to save a drawing as a template and you want the drawing page and document stencil to be as small as possible in terms of file size.

Figure 2. You can clean up a document stencil by deleting unneeded masters. If a master is still linked to a shape on the page, Visio warns you.
Troubleshooting
The Find Shape tool does not locate master shapes that have been customized
If you create your own master shapes and want them to appear when you are searching for shapes, you must include keywords with the master shape. The keywords correspond to the search text users type in the Search for Shapes box in the Shapes window and are used by Visio to index shapes for searching. Keywords are an option in the Master Properties dialog box. Visio 2003, unlike previous versions of Visio, searches your entire hard drive and the Internet by default. Hence it will find a stencil or shape that contains the keyword you typed in the Search for Shapes box no matter what the stencil's file path is.
Tip You can also assign keywords to your custom stencils. Searching for shapes will also pull up these stencils. To do so, open the stencil for editing (right-click the stencil and select Edit Stencil), and then right-click the stencil and select Properties. Type the keyword that you wish to associate with the stencil in the Keywords box.
Saving customized shapes as masters
In Visio 2003 you can drag any shape that you wish to save onto any open custom stencil, as Figure 3 shows. If the stencil is open as read-only, Visio asks you whether you want to open the stencil for editing, and if you click Yes, Visio creates a default master. That's the quickest way to create a master and save it on a stencil. You can then edit the master and its icon. Note that in this instance a read-only stencil is a custom stencil that has not been opened for editing. If the file was previously saved as a read-only file, you can edit it only if you remove the read-only status by browsing to the file in Microsoft Windows Explorer, displaying the file's properties, and clearing the Read-Only check box.

Figure 3. You can drag a shape onto any stencil to open the stencil for editing and save the shape as a master.
There are other ways to create a new master as well. You can do the following:
- Open a custom stencil for editing, add a new, blank master, and then create a shape. There might be an advantage to working this way; you get the same effect by creating your shape on the drawing page and then dragging it onto a stencil.
- Open a custom stencil for editing, edit an existing master, and then save your changes. This method is especially handy when you use a particular shape all the time and always edit it in the same way. You can instead go to the source and edit the master.
Tip You can create a master from an object that you have pasted or imported into the Visio application from another program.