Customization > Automation Interface > Functions > For User Interface > Functions for Text Editing Window > CloseTextEditor function (automation interface)
  
CloseTextEditor function (automation interface)
Syntax:
CloseTextEditor("<id>", "<property name>")
Where:
<id> is a string that specifies the id of the item that owns the property.
<property name> can be as follows:
Body for an Operation.
Full Text for a Note, Comment, Constraint and OSD Step Symbol.
Rtf for a Text Diagram.
Script for a Script.
EAB for an Event Actions Block.
Guard for a Guard Condition.
Event for a Change Event.
The CloseTextEditor function closes a text editor window or Code Editor window.
* 
you can close all text editor windows, diagrams and Code Editor windows through the CloseAllWindows function.
Examples
This example closes the text editor for a Text Diagram named Text Diagram1:
Set objDiagrams = ActiveProject.Item("Diagrams")
Set objTD = objDiagrams.Item("Text Diagram","Text Diagram1")
Call Studio.CloseTextEditor(objTD("ID"), "Rtf")