Word Macro to split Mail Merge Letters

Office 365 / SharePoint Blog

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

‘Create a new document to paste text from clipboard.

‘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:\” ‘VG change this to the folder you need to save to
DocNum = DocNum + 1
ActiveDocument.SaveAs FileName:=”test_” & DocNum & “.docx” ‘VG changed to docx
‘Move the selection to the next section in the document
Next i
ActiveDocument.Close savechanges:=wdDoNotSaveChanges
End Sub


From <http://wordribbon.tips.net/T008435_Merging_to_Individual_Files.html>