Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, and 2013. If you are using an earlier version (Word 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Word, click here: Merging to Individual Files.
by Allen Wyatt
(last updated January 16, 2014)
When you use the mail-merge feature in Word, you have the option of either printing your results directly or creating a new document. If you choose the latter option, the resulting document contains all the information that normally would have gone to the printer. For instance, if your merge document is a two-page letter, each letter in the resulting document is separated by a section break. Thus, if you are merging the two-page letter with 150 different addresses, then you would end up with a 300-page document with 150 section breaks (one every two pages).
For some people, it would be more helpful if you could merge to individual files. For instance, given the above example you might want 150 individual document files, each two pages long. Unfortunately, that is not one of the options available when using Word's mail-merge feature. The only answer to accomplishing this task is to create a macro that will, based on the merged document (the 300-page one mentioned above) take each section and save it to its own document file.
If you look in Microsoft's Knowledge Base, you will find that there is an old article that deals with this very issue:
The macro presented in the article, even though it was written for Word 97, will work just fine in Word 2007 and later versions. It allows you to separate a merged document into individual files, based on the section breaks:
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
It is important to realize, however, that this macro will only work if the only place that section breaks occur is between merged documents. If your original document includes section breaks, then the macro will not provide satisfactory results. For additional information on using the macro, refer to the Knowledge Base article at the link provided above.
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (8435) applies to Microsoft Word 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Word here: Merging to Individual Files.
Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!
One of the data sources that Word allows you to use for your mail merges is an Excel worksheet. You may get unexpected ...Discover More
When you create a mail-merged document, you might want some pages of the document printed on paper from one printer tray and ...Discover More
When you create a group of documents from a merge file, Word normally inserts section breaks between iterations of the ...Discover More
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.