Export (0) Print
Expand All
Cut
Run
Expand Minimize

Close Method (General Extensibility)

Visual Studio .NET 2003

Closes the open document and optionally saves it, or closes and destroys the window.

[Visual Basic .NET]
Public Sub Close( _
   Optional ByVal Save As vsSaveChanges = vsSaveChangesPrompt _
) 
[Visual Basic 6]
Sub Close( _
   Optional ByVal Save As vsSaveChanges = vsSaveChangesPrompt _
) 
[C++]
HRESULT __stdcall Close(
   vsSaveChanges Save
);
[C#]
void Close(
   vsSaveChanges Save
);
[JScript .NET]
public function Close(
   Save : vsSaveChanges
)

Parameters

Save
Optional. A vsSaveChanges constant that determines whether to save an item or items.

Example

Sub CloseExample()
   ' Closes all saved documents in the project.
   Dim doc As Document
   Dim docs As Documents
   docs = DTE.Documents

   MsgBox("Number of open docs: " & DTE.Documents.Count)
   For Each doc In docs
      MsgBox("Closing " & doc.Name)
      If doc.Saved Then
         doc.Close()
      End If
   Next
End Sub 

See Also

Applies To: Document Object | Window Object

Show:
© 2014 Microsoft