After reading multiple questions from people who wanted their default template to be something other than normal.dot, and working up code that automatically closed a new document that was based on a global template, I came up with the following. So far as I can tell it works. I’m sure there are drawbacks but so far all I’ve seen are:
1) The screen flicker as the documents are switched and
2) The new document numbers will be messed up and will skip numbers
I have tried generating labels with this in place but haven’t tried a mailmerge.
The code is placed in the “ThisDocument” object of normal.dot. The advantage is that normal.dot is still out there influencing things and available as a resource. However, you can’t create a new document based on normal.dot. It has to be based on another template.
In this case, the other template is presumed to be named “normal2.dot.”
Here’s the code:
Private Sub Document_New() ' Procedure written by Charles Kenyon 12 February 2002 ' Intended to close new document created from normal template ' Offers user choice to open the template ' ' This sub goes in the ThisDocument Object of normal.dot ' ' Declare variables Dim sTemplateName As String Dim sPath As String Dim sTempName As String ' On Error GoTo Oops ' ' Fill in variables sPath = Application.Options.DefaultFilePath(wdUserTemplatesPath) & "" ' ' Following is alternative if the template is in the Workgroup Templates folder ' sPath = Application.Options.DefaultFilePath(wdWorkgroupTemplatesPath) & "" ' ' Name of the alternative template - crucial! sTemplateName = "Normal2.dot" sTempName = ActiveDocument.FullName ' Application.Documents.Add Template:=sPath & sTemplateName Application.Windows(sTempName).Activate ' ' Close the new document based on normal.dot without saving changes ActiveDocument.Close SaveChanges:=False Exit Sub Oops: ' skips closing of new document based on Normal if error in procedure ' most likely error is that the alternative template isn't found End Sub
Thoughts? I’ve tested with Word 2000 and Word 97, both running under Win 98se.