Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
433 B
3
Indexable
Never
' Save the letter as PDF
Dim savePath As String
savePath = "C:\Path\To\Save\" & recipientName & "_Letter.pdf"

On Error Resume Next ' Continue execution if an error occurs
wordDoc.SaveAs2 savePath, FileFormat:=17 ' Save PDF with recipient's name
On Error GoTo 0 ' Reset error handling

If Dir(savePath) <> "" Then
    ' File saved successfully
Else
    MsgBox "Error: Unable to save the PDF file.", vbExclamation
End If
Leave a Comment