Visual Studio 2013
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Gets the active document.
Assembly: EnvDTE80 (in EnvDTE80.dll)
Sub ActiveDocumentExample() Dim objTextDoc As TextDocument Dim objEP As EditPoint ' Create a new text document. Call DTE2.ItemOperations.NewFile("General\Text File") 'Get a handle to the new document. Set objTextDoc = DTE2.ActiveDocument.Object("TextDocument") Set objEP = objTextDoc.StartPoint.CreateEditPoint 'Create an EditPoint and add some text. objEP.Insert "A test sentence." End Sub Sub DocumentExample() Dim doc As Document Dim desc As String Set doc = DTE2.ActiveDocument desc = "You are editing a " If (doc.ReadOnly) Then desc = desc & "read-only" Else desc = desc & "writable" End If desc = desc & " document called " & doc.Name & " located at " & doc.Path MsgBox desc End Sub
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.