Creates a new document and makes it active. Returns an instance of the Document object which corresponds to the created document.
Applies to: Application object
[[Set] documentRet =] object.CreateNewDoc () |
The CreateNewDoc method syntax has these parts:
Part | Description |
object | Required. An expression that returns an instance of the Application object. |
documentRet | Optional. A Document type variable. |
A new document is created based on the default settings or from a template file. It's added to the end of the document collection of the application. So, the expression below returns the most recent created or opened document:
thisApp.Doc( thisApp.DocsNum() ) ' returns most recent created or opened document
This example contains an application-level script. It demonstrates using the CreateNewDoc method. The script creates a new document, which contains the shape with "New Document" text on the first page.
Dim newDoc as Document ' Declare variables Dim shp_rect As Shape Set newDoc = thisApp.CreateNewDoc() ' Create a new document |
See Also |
CloseDoc method, Doc method, DocByName method, DocsNum method, FirstDoc method, NextDoc method, OpenDoc method, Document object |