Share via


ActiveDocument Property

Home Page (Objects)OverviewFAQReference

Applies to: Application object

Gets the Document or TextDocument object representing the active document.

Syntax

object**.ActiveDocument**

Parameters

object

An expression that evaluates to an Application object. When you access the ActiveDocument property of the Application object, you can omit object because the name of the Application object is implied when you access its properties and methods.

Remarks

The ActiveDocument property has the Document type.

The active document is the one edited in the most recently active application document window.

The document retrieved is a Document object or a TextDocument object. The type of object depends on the type of document.

Example

The following example, comments out the selected text in the active document:

ActiveDocument.Selection = "/*" + ActiveDocument.Selection + "*/"