Share via


Master.UniqueID Property

Visio Automation Reference

Returns the unique ID of a master. Read-only.

Version Information
 Version Added:  Visio 4.0

Syntax

expression.UniqueID

expression   An expression that returns a Master object.

Return Value
String

Remarks

A Master object always has a unique ID. If you copy a master, the new master has the same unique ID as the original master (as well as the same base ID). However, if you subsequently change the copy, Visio assigns it a new unique ID, but its base ID remains the same.

Note that if you copy into a stencil a master that has the same unique ID as a master already in the stencil, Visio assigns a new unique ID to the copy.

For more information about the base ID, see the BaseID property.

You can determine a Master object's unique ID by using the following code:

Visual Basic for Applications
  strID = vsoMaster.UniqueID

The value it returns is a string in the following form:

Visual Basic for Applications
  {2287DC42-B167-11CE-88E9-0020AFDDD917}

To get a master if you know its unique ID, use Masters.Item(UniqueIDString) .

For example, you can use the following code to retrieve the master from the Masters collection of the active document:

Visual Basic for Applications
  Dim vsoMaster As Visio.Master
Set vsoMaster = Visio.ActiveDocument.Masters("{0478DA94-1315-9876-8E4C-006523ABC9B2}")

Alternatively, you can use the following code, which adds the letter "U" before the string to identify it as a unique ID:

Visual Basic for Applications
  Dim vsoShape As Visio.Shape
Set vsoMaster = Visio.ActiveDocument.Masters("U{0478DA94-1315-9876-8E4C-006523ABC9B2}")

See Also