Previous Document Next Document

Object Model Reference : Classes : A : Application : Properties : Application.ActiveDocument


Application.ActiveDocument

Property ActiveDocument As Document

Description

Member of Application

The ActiveDocument property returns a read-only 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, consider the following code example:

Documents(1).Activate
ActiveDocument.AddPages 1

The preceding code example produces the same result as the following code example:

Documents(1).AddPages 1

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

VBA example

The following VBA 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 2013 Corel Corporation. All rights reserved.