Understanding the CorelDRAW object model : Working with pages : Activating pages |
Each page is a member of the Document.Pages collection for the document in which it appears. The pages in a Document.Pages collection appear in the order in which they appear in that document for example, the fifth page in the active document is ActiveDocument.Pages.Item(5)
. If pages are added, reordered, or deleted, the affected Pages collection is immediately updated to reflect the new page order of that document.
You can access the active page of the active document by using the Application.ActivePage property (or ActiveDocument.ActivePage
, or simply ActivePage
). A reference to the active page in the active document, of type Page, is returned.
Dim pg As Page |
Set pg = ActivePage |
You can access the active page of a document, regardless of whether that document is active, by using ActivePage property for that document:
Public Function getDocsActivePage(doc As Document) As Page |
Set getDocsActivePage = doc.ActivePage |
End Function |
You can switch pages by finding the desired page and then invoking its Activate method. The following VBA code activates page 3 in a document:
ActiveDocument.Pages(3).Activate |
If you want, you can use event handlers to respond to events that are triggered by activating a page:
• |
Document.PageActivate
|
You can also use event handlers to respond to events that are triggered by deactivating a page:
• |
Document.PageChange
|
Copyright 2013 Corel Corporation. All rights reserved.