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
with:
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
With these changes, you will get 20 separate documents for each record in your data source.