tl;dr: Use pdfsam
MS Word has a good form letter feature, but it’s limited in a way: when you want to save each form letter individually, you’re out of luck. You can only create a single Word document, which contains all letters. I was searching far and wide for a solution to my problem and stumbled upon some Add-ins, but what helped me the most is a simple macro.
I found this tip by Allen Wyatt.
This is the macro code:
Sub BreakOnSection() 'Used to set criteria for moving through the document by section. Application.Browser.Target = wdBrowseSection 'A mailmerge document ends with a section break next page. 'Subtracting one from the section count stop error message. For i = 1 To ((ActiveDocument.Sections.Count) - 1) 'Select and copy the section text to the clipboard ActiveDocument.Bookmarks("\Section").Range.Copy 'Create a new document to paste text from clipboard. Documents.Add Selection.Paste 'Removes the break that is copied at the end of the section, if any. Selection.MoveUp Unit:=wdLine, Count:=1, Extend:=wdExtend Selection.Delete Unit:=wdCharacter, Count:=1 ChangeFileOpenDirectory "C:\" DocNum = DocNum + 1 ActiveDocument.SaveAs FileName:="test_" & DocNum & ".doc" ActiveDocument.Close 'Move the selection to the next section in the document Application.Browser.Next Next i ActiveDocument.Close savechanges:=wdDoNotSaveChanges End Sub
You can change the directory to save to and the file name and extension in lines 20 and 22.
This didn’t quite work out as well as I hoped with actual documents. Headers and footers, for example, weren’t copied over to the newly created files.
I also tried the following, but this also didn’t behave well regarding the formatting.
Option Explicit Sub AllSectionsToSubDoc() Dim x As Long Dim Sections As Long Dim Doc As Document Application.ScreenUpdating = False Application.DisplayAlerts = False Set Doc = ActiveDocument Sections = Doc.Sections.Count For x = Sections - 1 To 1 Step -1 Doc.Sections(x).Range.Copy Documents.Add ActiveDocument.Range.Paste ActiveDocument.SaveAs (Doc.Path & "\" & x & ".doc") ActiveDocument.Close False Next x Application.ScreenUpdating = True Application.DisplayAlerts = True End Sub
I found this over at vbaexpress.com.
In the end I ended up using pdfsam.