Previous Document Next Document
Application.ActiveDocument

Property ActiveDocument As Document

Member of Application

The ActiveDocument property returns a reference to the active document.

You do not need to activate a document before working with it in CorelDRAW. The document stays inactive but you still can work with it. For example, examine the following two lines of code:

Documents(1).Activate 
ActiveDocument.AddPages 1 

These two lines of code produce the same result as the following:

Documents(1).AddPages 1 

Both of these examples add a new page to the first open document, which is the first document.

The ActiveDocument property returns a read-only value.

The following code example creates a new document and draws an ellipse in it. Then another document is created, and a rectangle is added to it. The first document is then activated and a new page is added to it.

Sub DocumentActive() 
 CreateDocument 
 ActiveLayer.CreateEllipse2 3, 2, 1 
 CreateDocument 
 ActiveLayer.CreateRectangle 2, 3, 4, 5 
 Documents(1).Activate 
 ActiveDocument.AddPages 1 
End Sub 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.