Microsoft Access has a built-in feature that allows you to export a report in PDF format. What you need to do is click the ‘PDF or XPS’ button on the ribbon. You’ll find this button in slightly different places depending on how you’re viewing the report. If you’re in Report mode, you’ll find it on the ‘External Data’ tab. If you’re in Print Preview mode, you’ll find it on the one and only tab available - ‘Print Preview’. Once you’ve clicked the button, you’ll be able to choose a file name and location, and Access will generate and save the PDF for you when you click the ‘Publish’ button.
If you only want to publish a certain page rage and not export the entire report, click the ‘Options’ button just before clicking ‘Publish’. Select the ‘Page(s)’ radio button and enter the ‘From’ and ‘To’ page numbers, and then press the ‘OK’ button.
If you only want to publish a certain page rage and not export the entire report, click the ‘Options’ button just before clicking ‘Publish’. Select the ‘Page(s)’ radio button and enter the ‘From’ and ‘To’ page numbers, and then press the ‘OK’ button.
How can I call this from VBA? I want to select the pages to send to pdf.
ReplyDeleteThis should do the trick:
DeleteDoCmd.OutputTo acOutputReport, "ReportName", acFormatPDF, "C:\YourFilePath\FileName.pdf", True
There are more details about how it works here: http://msdn.microsoft.com/en-us/library/office/ff192065(v=office.15).aspx.