I do something very similar but my Template will only create one new document.
When the template open's up, I have a UserForm pop up with three TextBoxes
and one Command Button. The TextBoxes are "Client Name" = txtName, Client ID#
= txtID, and Client Member Since = txtCMS
The Command button is simply a submit button.
' Tab order
Private Sub UserForm_Activate()
txtName.SetFocus
txtName.TabIndex = 0
txtID.TabIndex = 1
txtCMS.TabIndex = 2
cmdHeader.TabIndex = 3
End Sub
Private Sub cmdHeader_Click()
Unload frmHeader
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.TypeParagraph
Selection.Font.Bold = wdToggle
Selection.Font.Italic = wdToggle
NormalTemplate.AutoTextEntries("New Client, Page #, Date").Insert Where _
:=Selection.Range, RichText:=True
Selection.TypeParagraph
Selection.TypeText Text:=txtName.Text & vbTab & "Member Since: " &
txtCMS.Text & vbTab & "Member ID: " & txtID.Text & vbCrLf
If Selection.HeaderFooter.IsHeader = True Then
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Else
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
End If
Selection.Font.Italic = wdToggle
Selection.Font.Bold = wdToggle
Selection.TypeText Text:="JML"
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
' Document Properties
With ActiveDocument.CustomDocumentProperties
.Add Name:="ID", LinkToContent:=False, Type:=msoPropertyTypeNumber,
Value:=txtID.Text
.Add Name:="Member's Name", LinkToContent:=False,
Type:=msoPropertyTypeString, Value:=txtName.Text
End With
vAltDrive = MsgBox("Do you wish save this file to a floppy disk or thumb
drive?", vbQuestion + vbYesNo, "Save file to other folder")
If vAltDrive = vbYes Then
Set fd = Application.FileDialog(msoFileDialogSaveAs)
With fd
.InitialView = msoFileDialogViewLargeIcons
.InitialFileName = "E:\Work Briefcase\Clients\" & txtName.Text &
".doc"
If fd.Show = -1 Then .Execute
End With
End If
End Sub
I know this is a just a simple little code (most done with the record
feature - yuk), but it serves my purposes. I imagine that you could have a
UserForm create two documents or somehow pass the code from one document to
another. Sorry about leaving in a bunch of extra stuff like saving to a
floppy drive,