PageByID Method

Searches for a page by the specified ID (the ID property) in the page collection of the document. Returns an instance of the Page object, corresponding to the found page.

Applies to: Document object

Syntax

[[Set] pageRet =] object.PageByID ( pageID )

The PageByID method syntax has these parts:

Part Description
object Required. An expression, that returns an instance of the Document object.
pageID

Required. An expression that returns a Long value. Represents the ID of the page being searched.

pageRet Optional. A Page variable.

Remarks

If the page with the specified pageID wasn't found in the document, the method returns Nothing.

Example

This example contains a document-level script. The script removes all shapes on the page, specified by the user. The user specifies the ID of the page, then the PageByID method is used to find the page and the script removes all shapes and service objects on the page.

' Declare variables
Dim ppage As Page    ' page
Dim pageID As Long   ' Page ID

' Ask the user to input page ID
Let pageID = InputBox( "Enter ID of page :", "CLEAR UP Page!" )

' Get the reference to the page by the page ID
' provided by the user
Set ppage = thisDoc.PageByID( pageID )

' If the page with such ID was found 
' in the page collection of the document, clear the page
If ppage <> Null Then
    ' Remove all shapes on the page
    ppage.RemoveAllShapes()
    ' Remove all service objects on the page
    ppage.RemoveAllServObjs()
    ' Display a message that the page has been cleaned up
    MsgBox( "Page is clear!" )
Else
    ' Display a message the the page has not been found 
    MsgBox( "No page was chosen!" )
End If

 

See Also

AddPage method, FindPage method, Page method, PagesNum method, RemovePage method, RemovePageByID method, ReorderPage method, ReorderPageByID method, Page object