Word VBA Issue Printing to PDF

Viewed 137

I'm trying to print to pdf using the Adobe PDF (I am using Adobe Acrobat Pro DC). Unfortunately, my word file generates the pdf using the filename I've desired but the file size is 0KB and Adobe gives me the message that it can't open the file because it's not supported or the file is damaged. I've posted my code below but the file gets generated, however, it is just showing 0KB. I also have had to uncheck the "Rely on system fonts only; do not use document fonts" due to vba error that when you create a PS file you must rely on system fonts in order for the code to even run. When I manually print (ctrl + p) and choose the pages to print, I have no issues creating the file and don't need to uncheck the Adobe printer option regarding system fonts. I'm not sure why I'm having these issues with VBA code as I used the macro recorder as well to see the code in the first place.

Just FYI... there is a reason I need to use the Adobe PDF printer and not the windows PDF printer (it recognizes fields when file created with Adobe PDF than Windows PDF, which makes things much quicker when sending form for esign).

'''
Sub print_docs()

Dim mypath As String
Dim print_pages As String

mypath = Environ("UserProfile") & "\Desktop\"

print_path = mypath & primary_name & " Disclosures.pdf"
print_pages = std_pages & "," & state_pages & "," & lender_pages

ActivePrinter = "Adobe PDF"
Application.PrintOut _
    OutputFileName:=print_path, _
    Append:=False, _
    Range:=wdPrintRangeOfPages, _
    Item:= _
    wdPrintDocumentWithMarkup, _
    Copies:=1, _
    Pages:=print_pages, _
    PageType:= _
    wdPrintAllPages, _
    Collate:=True, _
    Background:=True, _
    PrintToFile:=True, _
    PrintZoomColumn:=0, _
    PrintZoomRow:=0, _
    PrintZoomPaperWidth:=0, _
    PrintZoomPaperHeight:=0
End Sub
'''
0 Answers
Related