Class Pages (Word VBA)

A collection of pages in a document. Use the Pages collection and the related objects and properties for programmatically defining page layout in a document. To use a Pages class variable it first needs to be instantiated, for example


Dim pgs as Pages
Set pgs = ActiveWindow.ActivePane.Pages

For Each

Here is an example of processing the Pages items in a collection.


Dim pag As Page
For Each pag In ActiveWindow.ActivePane.Pages
	
Next pag

Count

Returns a Long that represents the number of pages in the collection.


Dim lngCount As Long
lngCount = ActiveWindow.ActivePane.Pages.Count

Item

Returns an individual Page object in a collection.

Item (Index)

Index: The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.


Dim pag As Page
Set pag = ActiveWindow.ActivePane.Pages(Index:=1)