Pages Property

Microsoft Word Visual Basic

Pages Property

Returns a Pages collection that represents the pages in a document.

expression.Pages

expression    Required. An expression that returns a Pane object.

Example

The following example creates a line half an inch from the upper left corner of the active document across the page to the lower right corner of the page one half inch from the right and bottom edges of the page.

    Dim objPage As Page

Set objPage = ActiveDocument.ActiveWindow.Panes(1).Pages(1)

'Add new line to document
ActiveDocument.Shapes.AddLine _
    InchesToPoints(0.5), _
    InchesToPoints(0.5), _
    objPage.Width - InchesToPoints(0.5), _
    objPage.Height - InchesToPoints(0.5)