Pages.FindByPageID method (Publisher)

Returns a Page object that represents the page with the specified page ID number. Each page is automatically assigned a unique ID number when it is created. Use the PageID property to return a page's ID number.

Syntax

expression.FindByPageID (PageID)

expression A variable that represents a Pages object.

Parameters

Name Required/Optional Data type Description
PageID Required Long Specifies the ID number of the page that you want to return. Publisher assigns this number when the page is created.

Return value

Page

Remarks

Unlike the PageIndex property, the PageID property of a Page object won't change when you add pages to or rearrange pages in the publication. Therefore, using the FindByPageID method with the page ID number can be a more reliable way to return a specific Page object from a Pages collection than using the Item method with the page's index number.

Example

This example demonstrates how to retrieve the unique ID number for a Page object, and then use this number to return that Page object from the Pages collection and add a new shape to the page.

Sub FindPage() 
 Dim lngPageID As Long 
 
 'Get page ID 
 lngPageID = ActiveDocument.Pages.Add(Count:=1, After:=1).PageID 
 
 'Use page ID to add a new shape to the page 
 ActiveDocument.Pages.FindByPageID(PageID:=lngPageID) _ 
 .Shapes.AddShape Type:=msoShape5pointStar, _ 
 Left:=200, Top:=72, Width:=50, Height:=50 
 
End Sub

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.