Pages Property

Microsoft Publisher Visual Basic

Returns a Pages collection representing all the pages in the specified publication.

expression.Pages

expression    Required. An expression that returns one of the above objects.

ShowPages property as it applies to the ReaderSpread object.

Returns a Page object representing one of the pages that comprise the specified reader spread.

expression.Pages(Index)

expression    Required. An expression that returns one of the above objects.

Index   Required Long. The page from the reader spread to return. Can be either 1 or 2.

Remarks

A reader spread will consist of only one or two pages, hence the valid values for the Index argument.

Example

ShowAs it applies to the Document object.

The following example returns the Pages collection of the active publication and reports how many pages there are.

Dim pgsTemp As Pages

Set pgsTemp = ActiveDocument.Pages

With pgsTemp
    MsgBox "There are " & .Count _
        & " page(s) in the active publication."
End With
				

ShowAs it applies to the ReaderSpread object.

The following example checks the reader spread of the fifth page in the active publication to see if it contains more than one page. If it does, the example reports the page number of the second page in the spread.

Dim pageTemp As Page

With ActiveDocument.Pages(5).ReaderSpread
    If .PageCount > 1 Then
        Set pageTemp = .Pages(Index:=2)
        MsgBox "The page number of the second page " _
            & "in the spread is " & pageTemp.PageNumber
    Else
        MsgBox "The spread has only one page."
    End If
End With