Document object

Here is a summary of the most important properties and methods of the document:

Properties

 

Selection

The Selection Object

Paragraphs

The Paragraphs collection.

Text

The Text collection

Styles

Styles collection.

Frames

Frames collection.

Fields

Fields collection.

 

 

Methods

 

Activate

Makes the document the current one.

GetTitle

Returns title of the document.

Copy

Copies selection to the Clipboard.

Cut

Moves selection to the Clipboard.

Print star, end, copies, collate

Prints the document.

Paste()

Copies Clipboard to the current position of the Document; Deletes selection if any.

The easiest way to "get hold of" a document is to use ActiveDocument to refer to the current document. For example:

MsgBox ActiveDocument.GetTitle

would show the name of the current document. ActiveDocument can be used with any of the above properties and methods.

You can also refer to the active document when creating or opening documents. See Documents collection for more details. For example, to create and print a document:

Set mydoc = Documents.Add("NORMAL")

mydoc.Text.Insert 0, "hello from a macro"

mydoc.Print 1, 9999, 1, False