UniqueID property (Shape object)

Microsoft Visio Developer Reference

UniqueID property (Shape object)

   Example   

Returns or clears the unique ID of a shape.

Version added

4.0

Syntax

strRet = object.UniqueID(flag)

strRet

String. The unique ID of the Shape object.

object

Required. An expression that returns a Shape object.

flag

Required Integer. Gets, assigns, or clears the unique ID of a Shape object.

Remarks

By default, a shape does not have a unique ID. A shape acquires a unique ID only if you set its UniqueID property.

If a Shape object has a unique ID, no other shape in any other document will have the same ID.

The flag argument controls the behavior of the UniqueID property. It should have one of the following values.

Constant

Value

visGetGUID

0

visGetOrMakeGUID

1

visDeleteGUID

2

The constant visGetGUID returns the unique ID string only if the shape already has a unique ID. Otherwise it returns a zero-length string ("").

The constant visGetOrMakeGUID returns the unique ID string of the shape. If the shape does not yet have a unique ID, it assigns one to the shape and returns the new ID.

The constant visDeleteGUID clears the unique ID of a shape and returns a zero-length string ("").

You can access a shape with its unique ID using Shapes.Item(uniqueIDString).