Multiple files from Mail Merge.

T

Terry

I have created a mail merge document and now want to take
each of those files and save them seperately into
individual files. Can this be done? What steps do I take
to peform the task.
 
P

Peter Jamieson

Word doesn't have a built in feature for this, so you need a macro.
Something like

Sub splitandsave()

Dim i As Integer
Dim intDocumentCount As Integer
Dim strDocumentName As String
Dim oDoc As Document
Dim oPrintDoc As Document
Set oDoc = ActiveDocument
intDocumentCount = oDoc.Sections.Count
For i = 1 To intDocumentCount
oDoc.Sections.First.Range.Cut
Set oPrintDoc = Documents.Add
With oPrintDoc
.Content.Paste
If .Sections.Count > 1 Then
.Sections(2).PageSetup.SectionStart = wdSectionContinuous
End If
' change the following line to put the documents in the path you want with
the names you want.
.SaveAs "doc" & CStr(i) & ".doc"
.Close Savechanges:=False
End With
Next
Set oPrintDoc = Nothing
Set oDoc = Nothing
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top