Class Pages (Excel 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 workbook. To use a Pages class variable it first needs to be instantiated, for example


Dim pgs as Pages
Set pgs = ActiveChart.PageSetup.Pages

For Each

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


Dim pag As Page
For Each pag In ActiveChart.PageSetup.Pages
	
Next pag

Count

Returns the number of objects in the collection.


Dim lngCount As Long
lngCount = ActiveChart.PageSetup.Pages.Count

Item

Returns a Page object that represents a collection of pages in a workbook.

Item (Index)

Index: Index value of the page.


Dim pagItem As Page
Set pagItem = ActiveChart.PageSetup.Pages(Index:=1)