Share via


Documents Interface

Contains all Document objects in the environment, each representing an open document.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Syntax

'Declaration
<GuidAttribute("9E2CF3EA-140F-413E-BD4B-7D46740CD2F4")> _
Public Interface Documents _
    Inherits IEnumerable
[GuidAttribute("9E2CF3EA-140F-413E-BD4B-7D46740CD2F4")]
public interface Documents : IEnumerable
[GuidAttribute(L"9E2CF3EA-140F-413E-BD4B-7D46740CD2F4")]
public interface class Documents : IEnumerable
[<GuidAttribute("9E2CF3EA-140F-413E-BD4B-7D46740CD2F4")>]
type Documents =  
    interface
        interface IEnumerable
    end
public interface Documents extends IEnumerable

The Documents type exposes the following members.

Properties

  Name Description
Public property Count Gets a value indicating the number of objects in the Documents collection.
Public property DTE Gets the top-level extensibility object.
Public property Parent Gets the immediate parent object of a Documents collection.

Top

Methods

  Name Description
Public method Add Infrastructure. Microsoft Internal Use Only.
Public method CloseAll Closes all open documents in the environment and optionally saves them.
Public method GetEnumerator Returns an enumerator for items in the collection.
Public method Item Returns an indexed member of a Documents collection.
Public method Open Infrastructure. Microsoft Internal Use Only.
Public method SaveAll Saves all documents currently open in the environment.

Top

Remarks

Reference this collection by using DTE.Documents.

Examples

Sub DocumentsExample()
   ' Closes all saved documents.
   Dim iDoc As Integer
   For iDoc = 1 To DTE.Documents.Count
      If DTE.Documents.Item(iDoc).Saved Then
         DTE.Documents.Item(iDoc).Close()
      End If
   Next iDoc
End Sub

See Also

Reference

EnvDTE Namespace

Document