|
|
|
|
|
|
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:
|
- Copy the code above.
- Open Word.
- Alt + F11 to open the Visual Basic Editor.
- Insert-Module.
- Paste the code there.
- Close the VBE (Alt + Q or press the X in the top-right corner).
|
Test the code:
|
- Create a Mail Merge document with more than one data record.
- Tools | Macro | Macros, and double-click AllSectionsToSubDoc.
|
Sample File:
|
Mail Merge.zip 5.21KB
|
Approved by mdmackillop
|
This entry has been viewed 244 times.
|
|