Customization > Automation Interface > Functions > For User Interface > Functions for diagrams > OpenDiagram function (automation interface)
OpenDiagram function (automation interface)
Syntax:
OpenDiagram ("<id>")
Where:
<id> is a string that specifies the id of the diagram to open.
OpenDiagram opens a diagram in your model using the Diagram Object's Id property. This function returns a Boolean value to indicate success or failure.
You can use the LockDiagram function to lock and unlock a diagram, and the IsDiagramLocked function to determine whether a diagram is locked.
Examples
In this example, the script opens Class Diagram1 through its Id:
Set objDiagrams = ActiveProject.Item("Diagrams")
Set objDiagram = objDiagrams.Item("Class Diagram", "Class Diagram1")
strDiagram = objDiagram.Property("Id")
Call Studio.OpenDiagram(strDiagram)
Was this helpful?