The below is my Macro I am using in Word VBA Macro however it is overwriting multiple lines. I have 1199 lines of in my excel spreadsheet and some are duplicated so instead of the macro writing the code to automatically create a unique file name it is overwriting it each time therefore not achieving my end goal of hitting all 1199 people.
The end goal being sending the mail merge email to each and every participant of the 1199.
What would I need to add to this VBA macro to achieve this goal? I am stumped!
------------------
Sub MailMergeToPdf2()
Dim masterDoc As Document, recordNum As Integer, singleDoc As Document
Set masterDoc = ActiveDocument
For recordNum = 1 To masterDoc.MailMerge.DataSource.RecordCount
masterDoc.MailMerge.DataSource.ActiveRecord = recordNum
masterDoc.MailMerge.Destination = wdSendToNewDocument
masterDoc.MailMerge.DataSource.FirstRecord = recordNum
masterDoc.MailMerge.DataSource.LastRecord = recordNum
masterDoc.MailMerge.Execute False
Set singleDoc = ActiveDocument
singleDoc.SaveAs2 _
FileName:=masterDoc.MailMerge.DataSource.DataFields("DocFolderPath").Value & "\" & _
masterDoc.MailMerge.DataSource.DataFields("DocFileName").Value & ".docx", _
FileFormat:=wdFormatXMLDocument
singleDoc.Close False
Next recordNum
End Sub
----------------------
The end goal being sending the mail merge email to each and every participant of the 1199.
What would I need to add to this VBA macro to achieve this goal? I am stumped!
------------------
Sub MailMergeToPdf2()
Dim masterDoc As Document, recordNum As Integer, singleDoc As Document
Set masterDoc = ActiveDocument
For recordNum = 1 To masterDoc.MailMerge.DataSource.RecordCount
masterDoc.MailMerge.DataSource.ActiveRecord = recordNum
masterDoc.MailMerge.Destination = wdSendToNewDocument
masterDoc.MailMerge.DataSource.FirstRecord = recordNum
masterDoc.MailMerge.DataSource.LastRecord = recordNum
masterDoc.MailMerge.Execute False
Set singleDoc = ActiveDocument
singleDoc.SaveAs2 _
FileName:=masterDoc.MailMerge.DataSource.DataFields("DocFolderPath").Value & "\" & _
masterDoc.MailMerge.DataSource.DataFields("DocFileName").Value & ".docx", _
FileFormat:=wdFormatXMLDocument
singleDoc.Close False
Next recordNum
End Sub
----------------------