AddPage Method

Adds a new page to the page collection of the document. Returns an instance of the Page object, corresponding to the added page.

Applies to: Document object

Syntax

[[Set] pageRet =] object.AddPage ()

The AddPage method syntax has these parts:

Part Description
object Required. An expression, that returns an instance of the Document object.
pageRet Optional. A Page type variable.

Remarks

If for some reason the page couldn't be added to the document, the AddPage method returns Nothing. Note that a new page, created with AddPage, gets default properties. To change the properties of the page use the methods and properties of the Page object.

Example

The example below contains a document-level script. It demonstrates how the AddPage method is used to add a page to the document. Then an ellipse is created on the page, containing the name of the new page.

' Declare variables
Dim new_page As Page
Dim shp As Shape

' Add a new page to the document
Set new_page = thisDoc.AddPage()
' Make the page active
thisDoc.SetActivePageByID( new_page.ID )

' Draw an ellipse on the new page
Set shp = new_page.DrawOval( 100,100,1000,500 )

' Assign the page name as the text of the ellipse
shp.Text = ""
shp.SetPropertyFormula( "_PAGENAME()", CDPT_TEXT )
shp.RecalcProperty( CDPT_TEXT )

 

See Also

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