mail merge

S

S.Bronson

I would like to be able to have my users click a button to
merge several different letters without having to open
each document. Can this be done? Thanks
 
P

Peter Jamieson

Yes, but you will need a macro, and you will need to distribute that macro
to your users.

For example a basic Word VBA macro might be something like:

Sub MergeADocumentToPrinter(DocumentName As String)
Dim oDoc As Word.Document
Set oDoc = Application.Documents.Open(DocumentName)
With oDoc.Mailmerge
.DataSource.FirstRecord = wdDefaultFirstRecord
.DataSource.LastRecord = wdDefaultLastRecord
' change the destination as required
.Destination = wdSendToPrinter
.Execute
End With
oDoc.Close SaveChanges:=False
Set oDoc = Nothing
End Sub

Sub MergeSeveralFiles()

Call MergeADocumentToPrinter("c:\mymergedocs\first.doc")
Call MergeADocumentToPrinter("c:\mymergedocs\second.doc")
Call MergeADocumentToPrinter("c:\mymergedocs\third.doc")

' etc.

End Sub

Then attach the macro to a button using Tools|Customize|Commands to select
the Macros category, and drag the MergeSeveralFiles macro to a toolbar
button (you might also want to create a new toolbar).

(I haven't tested this one by the way, but you will obviously need to make
modifications.But the thing is that you need to consider how specific or
general your macro needs to be, e.g. whether each user is always performing
the same merges, or what.)

If you haven't used macros before you will find more useful info at

http://www.mvps.org/word/FAQs/MacrosVBA/CreateAMacro.htm

You will also need to distribute the macro to your users. I suggest you have
a look around the www.mvps.org/word site for other articles on that before
going too much further.
 

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