Creating Documents


Documents.Add

The new document will become the active document

Application.Documents.Add Template:="C:\Temp\Template.dot" 
                          NewTemplate:=
                          DocumentType:=
                          Visible:=True)

Template - The name of the template to be used for the new document. The default is the Normal template
NewTemplate - Whether to open the document as a template. The default is False
DocumentType - The type of new document to create. The default is NewBlankDocument
Visible - Whether the new document is visible. The default is True



Creating a blank document based on the Normal template

Documents.Add 
Set objDocument = Documents.Add

This method returns the document that was created.


Creating a copy of the active document

Application.Documents,Add Template:=ActiveDocument.FullName 


Creating a new document based on a different template

Application.Documents.Add Template:="C:\Temp\Template.dot" 
                          NewTemplate:=False
                          DocumentType:=wdNewDocumentType.wdNewBlankDocument, _
                          Visible:=True)


© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited TopPrevNext