How to Generate PDF from Mail Merge | Mail Merge Save Separate Files | Mail Merge to PDF and Doc

preview_player
Показать описание
#mailmerge #mailmergetopdf #mailmergesavesapratefiles #singlefileforeachrow #pdffromexcel
00:00 Intro How to use Mail Merge to Generate PDF
02:00 How to Setup Mail Merge Template to Get PDF
03:00 Mail Merge to Get Separate file for each record
07:00 Mail Merge to Separate PDF from Excel Data
10:00 Mail Merge Get Separate PDF for each row in excel
Рекомендации по теме
Комментарии
Автор

THIS WORKS! Thank you so so much! I will add that if the file name you want to create is not a number, use "As String" instead of "As Long" in the first line otherwise you will get a "Runtime Error 13".

Also if it helps, below is the VBA code so you can copy-paste and not be like me literally re-typing everything he has on the screen. Just pay attention to anything in {{ }}:


Sub GetPDF()

Dim {{merge field}} As String, file_path, folder_path As String
folder_path = folders}}"

If Dir(folder_path, vbDirectory) = "" Then
MkDir (folder_path)
End If

Dim masterDoc As Document, singleDoc As Document, lastRecordNum As Long
Set masterDoc = ActiveDocument

= wdLastRecord
lastRecordNum =
= wdFirstRecord

Do While lastRecordNum > 0

= wdSendToNewDocument
=
=
masterDoc.MailMerge.Execute False

{{merge field}} = field}}").Value

Set singleDoc = ActiveDocument
singleDoc.SaveAs2 FileName:=folder_path & "\" & {{merge field}} & ".docx",

singleDoc.ExportAsFixedFormat OutputFileName:=folder_path & "\" & {{merge field}} & ".pdf",
singleDoc.Close False

If >= lastRecordNum Then
lastRecordNum = 0
Else
= wdNextRecord
End If

Loop

End Sub

JeffFahndrich
Автор

Tried this but it is giving me 5487 cannot complete due to permission

kaira
Автор

Can you make this video in python laguage.

cpkanojiya