To open a new Word document based on an existing template, we
need to specify a value for the Template argument of the Add method of the
Documents collection.
If the template file (.DOT) is saved in the UserTemplates
path, we can use the pre-defined contant wdUserTemplatesPath.
Otherwise, we will need to supply the complete path to the template file.
Private mobjWordApp As Word.Application
Private Sub Command1_Click()
Const conTEMPLATE_NAME = "\Templates\merge.dot"
Set mobjWordApp = New Word.Application
With mobjWordApp
.Visible = True
.WindowState = wdWindowStateMaximize
.Documents.Add Template:=(.Options.DefaultFilePath( _
wdUserTemplatesPath) _
& conTEMPLATE_NAME)
End With
End Sub
|