I have my document set up to automatically pull the data source for the mail merge.
From there, I'd like to save each page as it's own document and set the file name to one of the mail merge values.
Right now I do the mail merge and then go to "Finish & Merge" and then "Edit Individual Documents" before running a global (Normal) macro to save each page at the break but it's saving as Page1, Page2, etc.
I want to eliminate this step and only have to open the document, pull the data from the source by clicking yes and then run the macro from there and save each mail merge as it's own document.
Bonus points if it would be possible to automatically run the macro after the mail merge completes and not have to open the Macro window to launch the macro.
This is the script. I want to eliminate having to "Finish & Merge" "Edit Individual Documents.
Sub Separate_NEO_Letters()
'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.Add
Selection.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 "S:\IT\NEO\Automation\Generated Letters"
DocNum = DocNum + 1
ActiveDocument.SaveAs FileName:="Page" & 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