I have a macro that works beautifully for splitting the merged doc into separate files. The issue is that these new files don't contain the page formatting of the original docs. It's a huge form very dependent on having the formatting exact. Any solutions for additions to the code to make this happen? The macro is below and came from this site. I am major newbie with macros so any help will be great.
Code:
Sub cdpdep()
'
' cdpdep Macro
'
'
Sub BreakOnSection()
'Used to set criteria for moving through the document by section.
Application.Browser.Target = wdBrowseSection
'A mailmerge document ends with a section break next page.
'Subtracting one from the section count stop error message.
For i = 1 To ((ActiveDocument.Sections.Count) - 1)
'Select and copy the section text to the clipboard
ActiveDocument.Bookmarks("\Section").Range.Copy
'Create a new document to paste text from clipboard.
Documents.AddSelection.Paste
'Removes the break that is copied at the end of the section, if any.
Selection.MoveUp Unit:=wdLine, Count:=1, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
ChangeFileOpenDirectory "C:\"
DocNum = DocNum + 1
ActiveDocument.SaveAs fileName:="test_" & DocNum & ".doc"
ActiveDocument.Close
'Move the selection to the next section in the document
Application.Browser.Next
Next i
ActiveDocument.Close savechanges:=wdDoNotSaveChanges
End Sub
Sub Macro1()
'
' Macro1 Macro
'
'
End Sub
Last edited by a moderator: