This article explains how to display text that is derived from a shape's custom properties in Microsoft Visio. In this article, the "process" shape from the Basic flowchart stencil is used for illustration purposes. If you use an alternate shape, make sure the shape has custom properties, and that you have entered values into the custom properties.
This article assumes that you have used the ShapeSheet before and are familiar with adding sections and typing formulas.
A simple example
Drag the "process" shape to the drawing page. Right-click the shape to enter values into the three custom properties (cost, duration, and resources). Each property accepts only a numeric value.
While the shape is still selected, click Field on the Insert menu.
On the Category menu, click Custom Formula.
Once chosen, the Custom Formula bar becomes active. Place the mouse pointer in the field and type Prop.Cost.
Click OK. The shape's text now displays the value of the Prop.Cost row in the Custom Properties section of the ShapeSheet.
Determining the valid row names
For a shape that already has custom properties, it is necessary to determine how to properly reference the custom property rows.
While the shape is selected, click Show ShapeSheet on the Window menu.
Scroll to find the Custom Properties section of the ShapeSheet. If it is not visible, click Sections on the View menu. Check custom properties.
The Custom Properties section will have named rows. The "process" shape has 3: Prop.Cost, Prop.Duration, and Prop.Resources. The "Prop" in the name is added automatically by Visio.
A complex example
The simple example works satisfactorily to display one custom property. The following example explains how to add additional text and custom properties to the display. Again, using the "process" shape with values added into the custom properties, select the text tool, and then follow these steps:
Type the following:
Cost: $Follow steps 1 through 4 in the "A simple example" section earlier in this article. Then press ENTER.
Type the word:
Duration:Follow steps 1 through 4 again and enter the Custom Formula as Prop.Duration. Then press ENTER. If desired, type in the time frame such as "week."
Resources:Follow steps 1 through 4 again and enter the Custom Formula as Prop.Resources.
The resulting shape should look similar to figure 1.
A more complex example: Choosing to display or hide custom properties
The following example shows how to set a right mouse action to display or hide the custom property values on the shape. This example uses the already modified process shape from the previous example.
To see this example, follow these steps:
Scroll to find the User-defined Cell section of the ShapeSheet. If the User-defined Cell section of the ShapeSheet is not visible, click Sections on the View menu, and then examine User-defined Cell.
Create a new row and name it HideProperties. The value and the prompt for this section should remain unchanged.
Add two additional rows to the end of the Actions section of the ShapeSheet.
Add the following formulas or values to this section.
Note In Microsoft Office Visio 2003 or in Microsoft Visio 2002, you cannot find Prompt in the Action section.
In the Miscellaneous section of the ShapeSheet, type the following cell reference in the HideText cell:
Now, when you right-click the shape, there will be two additional options: Show Properties and Hide Properties. By selecting either option, you can decide whether to display text or to hide text.
If you want to prevent a user from overriding the new formulas by entering text manually into the shape, protect the shape's text against editing by typing 1 in the LockTextEdit cell in the Protection section of the ShapeSheet.