This documentation is archived and is not being maintained.

Item Property and Unique ID Behavior in Different Versions of Visio

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
 

Microsoft Corporation

September 2001

Applies to:
   Microsoft Visio Standard 2002
   Microsoft Visio Professional 2002
   Microsoft Visio Standard 2000
   Microsoft Visio Professional 2000
   Microsoft Visio Technical 2000
   Microsoft Visio Enterprise 2000
   Visio Standard 5.0
   Visio Professional 5.0
   Visio Technical 5.0

Summary: This article discusses how the Item property behaves differently in Visio 2002, Visio 2000, and Visio 5.0 when you use it and a shape's unique ID to find the shape in a Shapes collection. (3 printed pages)

Contents

Item Property Behavior Change
Comparing Item Property Behavior
Updating Visio 2000 Code
Additional Information

Item Property Behavior Change

The Item property behaves differently in Microsoft® Visio® 2002, Visio 2000, and Visio 5.0 when you use it and a shape's unique ID to find the shape in a Shapes collection. One of the methods for programmatically searching for a shape is to pass its UniqueID string to the Item property of a Shapes collection, and then search for the shape in the Shapes collection for the page, master, or group, and the shapes in the containing collection shape. The set of shapes the Item property examines in Visio 2000 is different than Visio 2002, so code written for Visio 2000 may behave differently after you upgrade to Visio 2002.

Comparing Item Property Behavior

The following table compares Item property behavior in Visio 2002, Visio 2000, and Visio 5.0, specifically when passing a shape's unique ID to a shape in a Shapes collection. Visio 2000 behavior is different than all other versions of Visio, while the behavior of Microsoft Visio 2002 and Visio 5.0 is the same.

Table 1. Item Property Behavior Comparison across Visio Versions

ProductBehaviorSyntaxExample Code
Visio 2002Search for all shapes in the Shapes collection, the shapes within groups, and the shapes in the containing collection shape.Need asterisk (*).
shpsObj.Item ("*{GUID}")
Visio 2002Search for all shapes in the Shapes collection; shapes within groups are not searched.Don't need asterisk.
shpsObj.Item ("{GUID}")
Visio 2000Search for all shapes in the Shapes collection, the shapes within groups, and the shapes in the containing collection shape.Don't need asterisk.
shpsObj.Item ("{GUID}")
Visio 2000Search for all shapes in the containing Page or Master collection shape.Need asterisk (*).
shpsObj.Item ("*{GUID}")
Visio 5.0 Search for all shapes in the Shapes collection, the shapes within groups, and the shapes in the containing collection shape.Need asterisk (*). Same as Microsoft Visio 2002.
shpsObj.Item ("*{GUID}")
Visio 5.0 Search for all shapes in the Shapes collection; shapes within groups are not searched.Don't need asterisk. Same as Microsoft Visio 2002.
shpsObj.Item ("{GUID}")
Note:   With Visio 2000, there is no direct method for searching all shapes in a containing group shape using a unique ID.

Updating Visio 2000 Code

You may need to update code written for Visio 2000 to reflect syntax changes discussed in the previous table so it behaves as expected after you upgrade to Visio 2002. Specifically, you might need to add an asterisk (*) to your code to search for all shapes in the Shapes collection, the shapes within groups, and the shapes in the containing collection shape.

Additional Information

For more information about programmatically searching for shapes within groups using the Item property, search for Item property in the Microsoft Visio 2002 online Help (on the Help menu, click Developer Reference).

For more information about unique IDs, search for UniqueID property in the Microsoft Visio 2002 online Help (on the Help menu, click Developer Reference).

Show: