S
S trainer
The following code works really well for splitting a merged document into
separate documents and saving them as files; but the header and footer
information from the original merged document is missing in the individual
documents. Is it possible to have the footer and header from the original
merge document appear in the individual documents?
Sub MailMergeLetterSplitter()
'
' MailMergeLetterSplitter Macro
' Macro created 1/24/2007 by solsenb
'
' splitter Macro
' Macro created by Doug Robbins to save each letter created by a mailmerge
as a separate file.
Dim i As Long, Source As Document, Target As Document, Letter As Range
Set Source = ActiveDocument
For i = 1 To Source.Sections.Count
Set Letter = Source.Sections(i).Range
Letter.End = Letter.End - 1
Set Target = Documents.Add
Target.Range = Letter
Target.SaveAs FileName:="Letter" & i
Target.Close
Next i
End Sub
separate documents and saving them as files; but the header and footer
information from the original merged document is missing in the individual
documents. Is it possible to have the footer and header from the original
merge document appear in the individual documents?
Sub MailMergeLetterSplitter()
'
' MailMergeLetterSplitter Macro
' Macro created 1/24/2007 by solsenb
'
' splitter Macro
' Macro created by Doug Robbins to save each letter created by a mailmerge
as a separate file.
Dim i As Long, Source As Document, Target As Document, Letter As Range
Set Source = ActiveDocument
For i = 1 To Source.Sections.Count
Set Letter = Source.Sections(i).Range
Letter.End = Letter.End - 1
Set Target = Documents.Add
Target.Range = Letter
Target.SaveAs FileName:="Letter" & i
Target.Close
Next i
End Sub