- VBA Code PDF Converter
- Manually Save Word as PDF
1.VBA Code to Convert Word to PDF
Word VBA has a direct function to export word document into PDF & XPS format. The function name is ExportAsFixedFormat. Just use this function, pass the output PDF file name along with path. If required pass the starting & ending page numbers.Sub saveWordasPDF()
'Define File Path
sFilePath = "<D:/foldername/pdffilename.pdf"
'Export as PDF
ActiveDocument.ExportAsFixedFormat _
outputfilename:=sFilePath, _
exportformat:=wdExportFormatPDF, _
openafterexport:=True
End Sub
After executing the code, go to the output folder path. Verify whether the PDF file is generated.
In case the PDF alignment or text format is not in proper format, then modify the input word document accordingly.
2. Manually Export Word to PDF
This method is also straight forward one. The option is available in the MS Word Menu itself. Follow these steps to export Word to PDF- Click on File Menu
- Choose 'SaveAs' option.
- Select Folder path.
- In 'Save type as' drop-down, choose PDF.
- Click Ok