Word

Save Each Mail Merge Document Separately

Ease of Use

Easy

Version tested with

2002 

Submitted by:

Jacob Hilderbrand

Description:

This macro will save each seperate document from a mail merge. 

Discussion:

You have a mail merge to email or print a lot of letters, but you want to save each individual one. This macro will save each document from the mail merge for you. 

Code:

instructions for use

			

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

How to use:

  1. Copy the code above.
  2. Open Word.
  3. Alt + F11 to open the Visual Basic Editor.
  4. Insert-Module.
  5. Paste the code there.
  6. Close the VBE (Alt + Q or press the X in the top-right corner).
 

Test the code:

  1. Create a Mail Merge document with more than one data record.
  2. Tools | Macro | Macros, and double-click AllSectionsToSubDoc.
 

Sample File:

Mail Merge.zip 5.21KB 

Approved by mdmackillop


This entry has been viewed 244 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2020 VBA Express