Specify a template when merging?

C

Colin Halliday

Is it possible to specify a template to use for the mailmerge document
rather than use the normal template?

If, for example, I wish to use the beforeprint vba event to do some
processing before printing of the merged document, I could build this into a
template and specify that this particular template be used when I generate
the merged document from the form letter document.

Thanks.
 
D

Doug Robbins - Word MVP

There is nothing to stop you creating a document from any template of your
choosing and then using that document as a mailmerge main document. Rather
than use the Mail Merge Wizard however, you should display the Mail Merge
toolbar, via View>Toolbars and then use the left-hand button on the toolbar
to change the document to a formletter type document.

It may however be one of the mailmerge events that you will need to use,
rather than a before print event, particularly if you want the event to
function during the execution of the merge to the printer.

Otherwise, you could just have the code that you wish to use in an add-in
that you could invoke whenever it is required.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
C

Colin Halliday

Thanks for the reply, but it is the mailmerge document, not the form letter
that I want to specify a template for; i.e. the document that is created
when you complete the merge to a new document.

Colin


Doug Robbins - Word MVP said:
There is nothing to stop you creating a document from any template of your
choosing and then using that document as a mailmerge main document.
Rather than use the Mail Merge Wizard however, you should display the Mail
Merge toolbar, via View>Toolbars and then use the left-hand button on the
toolbar to change the document to a formletter type document.

It may however be one of the mailmerge events that you will need to use,
rather than a before print event, particularly if you want the event to
function during the execution of the merge to the printer.

Otherwise, you could just have the code that you wish to use in an add-in
that you could invoke whenever it is required.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
D

Doug Robbins - Word MVP

If you execute the merge to a new document, then you could use the following
macro to split it into individual documents based on the template that you
want to use by specifying the template in the line Set Target =
Documents.Add(Template Name)

Sub splitter()
' splitter Macro
' Macro created by Doug Robbins to save each letter created by a mailmerge
' as a separate file, retaining the header and footer information.
Dim i As Long, Source As Document, Target As Document, Letter As Range
Set Source = ActiveDocument
For i = 1 To Source.Sections.Count
Set Letter = Source.Sections(i).Range
Set Target = Documents.Add
Target.Range = Letter
Target.Sections(2).PageSetup.SectionStart = wdSectionContinuous
Target.SaveAs FileName:="Letter" & i
Target.Close
Next i
End Sub


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

Colin Halliday said:
Thanks for the reply, but it is the mailmerge document, not the form
letter that I want to specify a template for; i.e. the document that is
created when you complete the merge to a new document.

Colin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top