Previous Document Next Document

Understanding the CorelDRAW object model : Working with documents : Creating documents


Creating documents

The Application object has two methods for creating documents: CreateDocument and CreateDocumentFromTemplate.

The Application.CreateDocument method creates an empty document based on the default page size, orientation, and styles:

Application.CreateDocument() As Document

The Application.CreateDocumentFromTemplate method creates an untitled document from a specified template (CDT) file:

Application.CreateDocumentFromTemplate(Template As String, _
[IncludeGraphics As Boolean = True])As Document

Both of these functions return a reference to the new document, so they are typically used in the following manner:

Dim newDoc as Document
Set newDoc = CreateDocument

The new document becomes active immediately and can be referenced by using the Application.ActiveDocument property. For more information on this property, see Activating documents.

If you want, you can use event handlers to respond to events that are triggered by creating a document:

 
AddinHook.New
 
Application.DocumentNew
 
GlobalMacroStorage.DocumentNew

Previous Document Next Document Back to Top

Copyright 2013 Corel Corporation. All rights reserved.