0% found this document useful (0 votes)
10 views1 page

Mail Merge to PDF Automation Script

Uploaded by

asrimaryana9
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views1 page

Mail Merge to PDF Automation Script

Uploaded by

asrimaryana9
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

Sub MailMerge2PDF()

' Macro created by Imnoss Ltd


' Please share freely while retaining attribution
' Last Updated 2021-05-03
Dim masterDoc As Document, singleDoc As Document, lastRecordNum As Long
Set masterDoc = ActiveDocument

[Link] = wdLastRecord
lastRecordNum = [Link]

[Link] = wdFirstRecord
Do While lastRecordNum > 0
[Link] = wdSendToNewDocument
[Link] =
[Link]
[Link] =
[Link]
[Link] False
Set singleDoc = ActiveDocument
singleDoc.SaveAs2 _
FileName:=[Link]("LokasiDOC").Value
& [Link] & _
[Link]("NamaDOC").Value &
".docx", _
FileFormat:=wdFormatXMLDocument
[Link] _

OutputFileName:=[Link]("LokasiPDF").Value &
[Link] & _
[Link]("NamaPDF").Value &
".pdf", _
ExportFormat:=wdExportFormatPDF
[Link] False
If [Link] >= lastRecordNum Then
lastRecordNum = 0
Else
[Link] = wdNextRecord
End If

Loop
End Sub

You might also like