title: MS Word Mail Merge and Split Documents saving, Header and footer issue
body: <p>I am using the below Macro to split the mail merged into separate documents. What I need is it to split into separate documents keeping the whole page including the header and footers and saving as in the first merged field on the page, which is the first piece of information on the merged letters. </p>
  
  <p>However, the macro runs only on one letter not the rest, and the format is completely incorrect. It changes the font, page layout and does not include the headers and footers. It also saves as 'Ref' rather than the first merged field on the letter. </p>
  
  <p>Does anyone have any idea how to amend the code below so it correctly updates with the above and for all letters please? I understand if this looks really bad but I am new to VBA and no one on my project to ask for help. Thanks in advance</p>
  
  <pre><code>Sub splitter()
  ' Based on a macro by Doug Robbins to save each letter created by a mailmerge as a separate file.
  ' With help from http://www.productivitytalk.com/forums/topic/3927-visual-basic-question-for-merge-fields/
  Dim i As Integer
  Dim Source As Document
  Dim Target As Document
  Dim Letter As Range
  Dim oField As Field
  Dim Ref As String
  Set Source = ActiveDocument
  For i = 1 To Source.Sections.Count
      Set Letter = Source.Sections(i).Range
      Letter.End = Letter.End - 1
          For Each oField In Letter.Fields
          If oField.Type = wdFieldMergeField Then
              If InStr(oField.Code.Text, "Ref") &gt; 0 Then
              'get the result and store it the Ref variable
              Ref = oField.Result
              End If
          End If
          Next oField
      Set Target = Documents.Add
      Target.Range = Letter
      Target.SaveAs FileName:="\\svr4958file01\Libraries\u20480\Documents\On Hold letters Template\20150512 On hold Letters Customers Active and Cancelled\" &amp; "Ref"  
  Target.Close
  Next i
  End Sub
  </code></pre>