Document Property

Applies To

Pane object, Selection object, Window object.

Description

Returns a Document object associated with the specified pane, window, or selection. Read-only.

Example

This example displays the document name and path for the selection.

Msgbox Selection.Document.FullName
This example sets myDoc to the document associated with the active window. The focus is changed to the next window, and the window is split. The Activate method is used to switch back to the original document.

Set myDoc = ActiveWindow.Document
If Windows.Count >= 2 Then 
    ActiveWindow.Next.Activate
    ActiveWindow.Split = True
    myDoc.Activate
End If