Microsoft KB Archive/254730

= How to display custom properties as text in Visio =

Article ID: 254730

Article Last Modified on 4/11/2007

-

APPLIES TO


 * Microsoft Office Visio Standard 2007
 * Microsoft Office Visio Professional 2007
 * Microsoft Office Visio Standard 2003
 * Microsoft Office Visio Professional 2003
 * Microsoft Visio 2002 Standard Edition
 * Microsoft Visio 2002 Professional Edition
 * Microsoft Visio 2000 Standard Edition
 * Microsoft Visio 2000 Professional Edition
 * Microsoft Visio 2000 Technical Edition
 * Microsoft Visio 2000 Enterprise Edition

-



This article was previously published under Q254730



SUMMARY
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.
 * 1) While the shape is still selected, click Field on the Insert menu.
 * 2) On the Category menu, click Custom Formula.
 * 3) Once chosen, the Custom Formula bar becomes active. Place the mouse pointer in the field and type Prop.Cost.
 * 4) 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.
 * 1) While the shape is selected, click Show ShapeSheet on the Window menu.
 * 2) Scroll to find the Custom Properties section of the ShapeSheet. If it is not visible, click Sections on the View menu. Check custom properties.
 * 3) 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." Type

Resources:

Follow steps 1 through 4 again and enter the Custom Formula as Prop.Resources.

The resulting shape should look similar to figure 1.



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.</li> 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.</li> In the Miscellaneous section of the ShapeSheet, type the following cell reference in the HideText cell:

User.HideProperties

</li> 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.</li> 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.</li></ol>

Additional query words: VSO2007 VSO2003 VSO2002

Keywords: kbgraphxlinkcritical kbhowto KB254730

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.