#1
|
|||
|
|||
Automate Mailmerge for multiple documents from one datasheet
Hi!
I've created a mailmerge for about 20 different Word documents that all use the same data from my single data sheet. Currently, I have to go into each Word document and save the mailmerge as a PDF. This is fine but gets tiring when it needs to be done 20 times. I've tried to automate this with VBA however when I open the Word document using VBA, it does not recognise it as being mailmerged and only opens the template file, which makes the whole mailmerge pointless. The mailmerge link is just removed. Does anyone know why VBA does not open the mailmerged documents and if this can be fixed? Are there even any other, better ways to automate the creation of 20 documents all using data from a single excel sheet? For info, each document is just a clients personal information and using a mailmerge is just quicker than copying/editing/amending each document! Many thanks for any help. Fred |
#2
|
||||
|
||||
While it is not exactly clear what you are doing, DocBundler (Create multiple documents from commond data sheet) may work for you.
Alternatively you may be able to use Merge and Split to create individual merge documents in PDF format.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#3
|
|||
|
|||
This is written to give Graham a better idea of what it is I think you want to be doing. I use templates of primary merge documents like this to produce draft pleadings and letters for cases.
However, I name and save documents based on a combination of the document property "Title" and the date. It should also be possible to save a merge field or two as document variables in the new document and use those as well. I am unsure how I would do that. The processes for that are a Save intercept it the templates. If a completed merge were done rather than a preview, I believe the link to the intercept macro would be lost. It should still be possible to do but I have not tried it. I am only doing one to three documents at a time, and seldom the same ones, so I do not batch process. |
#4
|
|||
|
|||
Automating Mail Merge
Hi Fredstar
I recently produced some scripts to automate mail merge and the code could well be adapted to suit your purpose. Head to Automating Mail Merge with Microsoft Word to see if this could help. |
#5
|
||||
|
||||
I have been thinking about this for the past few days and felt it worth producing an add-in to merge a group of documents to document or PDF format and including the option to merge to e-mail attachments, each using the same worksheet. I will make it available from my web site in due course, but if you want to try it in the meantime, contact me via my web site.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#6
|
||||
|
||||
If you combine all the mailmerge main documents into a single document, with a separate Section for each of your present source documents, you could use the code from the Send Mailmerge Output to Individual Files example in the Mailmerge Tips & Tricks 'Sticky' thread at the top of this forum (https://www.msofficeforums.com/mail-...ps-tricks.html) with the following modifications:
1. Add , Sctn As Section to the 'Dim' line at the top of the code 2. Replace: Code:
.SaveAs FileName:=StrFolder & StrName & ".docx", FileFormat:=wdFormatXMLDocument, AddToRecentFiles:=False ' and/or: .SaveAs FileName:=StrFolder & StrName & ".pdf", FileFormat:=wdFormatPDF, AddToRecentFiles:=False Code:
For Each Sctn In .Sections Sctn.Range.Select With Selection Do While .Characters.Last = Chr(12) .End = .End - 1 Loop End With .ExportAsFixedFormat OutputFileName:=StrFolder & StrName & "_" & Sctn.Index & ".pdf", _ ExportFormat:=wdFormatPDF, OpenAfterExport:=False, _ OptimiseFor:=wdExportOptimizeForPrint, Range:=wdExportSelection Next
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
||||
|
||||
Quote:
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
Tags |
mailmerge automate |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Sorting an excel datasheet | AydanAr | Excel | 5 | 03-15-2019 02:50 AM |
Best way to automate combining of multiple workbook data on trigger? | dylansmith | Excel Programming | 4 | 02-13-2017 04:33 AM |
How to automate opening multiple URLs from an Excel Spreadsheet? | rishumehra | Excel Programming | 0 | 01-28-2016 01:49 AM |
Mailmerge Individual Documents | DaddyMac | Mail Merge | 4 | 06-06-2013 09:22 PM |
Merge Word documents using a mailmerge field | Concertina | Mail Merge | 3 | 02-18-2013 04:12 AM |