calypso
11-15-2017, 01:23 PM
Hello,
I am trying to save a Mail Merger Word doc as individual files. I created the macro below to save the first of the 150 documents, but was hoping someone could help me fix the macro to loop and save all 150 mailmerger docs with subsequent file names, i.e. 001.docx, 002.docx, 003.docx, 004.docx, etc. : Would really appreciate some insight on how to do this properly. Thank you very much.
Sub Macro1()
'
' Macro1 Macro
'
'
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
With .DataSource
.FirstRecord = 1
.LastRecord = 1
End With
.Execute Pause:=False
End With
ActiveDocument.SaveAs2 FileName:="Contact Info 001.docx", _
FileFormat:=wdFormatXMLDocument, LockComments:=False, Password:="", _
AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, _
EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData _
:=False, SaveAsAOCELetter:=False, CompatibilityMode:=15
ActiveWindow.Close
End Sub
I am trying to save a Mail Merger Word doc as individual files. I created the macro below to save the first of the 150 documents, but was hoping someone could help me fix the macro to loop and save all 150 mailmerger docs with subsequent file names, i.e. 001.docx, 002.docx, 003.docx, 004.docx, etc. : Would really appreciate some insight on how to do this properly. Thank you very much.
Sub Macro1()
'
' Macro1 Macro
'
'
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
With .DataSource
.FirstRecord = 1
.LastRecord = 1
End With
.Execute Pause:=False
End With
ActiveDocument.SaveAs2 FileName:="Contact Info 001.docx", _
FileFormat:=wdFormatXMLDocument, LockComments:=False, Password:="", _
AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, _
EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData _
:=False, SaveAsAOCELetter:=False, CompatibilityMode:=15
ActiveWindow.Close
End Sub