Customization > Automation Interface > Functions > For User Interface > Functions for diagrams > CloseDiagram function (automation interface)
  
CloseDiagram function (automation interface)
Syntax:
CloseDiagram("<id>")
Where:
<id> is a string that specifies the id of the diagram to close.
CloseDiagram closes a diagram that is open in Modeler.
* 
You can use the CloseAllWindows function to close all open diagrams and text editor windows.
Examples
This example closes Class Diagram1 through its Id:
Set objDiagrams = ActiveProject.Item("Diagrams")
Set objDiagram = objDiagrams.Item("Class Diagram", "Class Diagram1")
strDiagram = objDiagram.Property("Id")
Call Studio.CloseDiagram(strDiagram)