Class Page (Excel VBA)

The class Page represents a page in a workbook. Use the Page object and the related methods and properties for programmatically defining page layout in a workbook.

Set

To use a Page class variable it first needs to be instantiated, for example

Dim lngIndex As Long: lngIndex = 
Dim psp As PageSetup: Set psp = 
Dim pagPage As Page
Set pagPage = psp.Pages(Index:=lngIndex)

The following procedures can be used to set variables of type Page: Pages.Item, PageSetup.EvenPage, PageSetup.FirstPage and PageSetup.Pages

For Each

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

Dim psp As PageSetup: Set psp = 
Dim pagPage As Page
For Each pagPage In psp.Pages
	
Next pagPage

CenterFooter

Specifies a picture or text to be center-aligned in the page footer.

CenterHeader

Specifies a picture or text to be center-aligned in the page header.

LeftFooter

Specifies a picture or text to be left-aligned in the page footer.

LeftHeader

Specifies a picture or text to be left-aligned in the page header.

RightFooter

Specifies a picture or text to be right-aligned in the page footer.

RightHeader

Specifies a picture or text to be right-aligned in the page header.

Pages.Count

Returns the number of objects in the collection.

Pages.Item

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

Syntax : expression.Item (Index)

Index: Index value of the page.