logo
search
Printing Problems

How to Print Existing PDF Pages Using Excel VBA

Huda QurayshiHuda Qurayshi Oct 10, 2026 869 views

Question details

The user needs a method to print specific pages from an already existing PDF file using an Excel VBA macro.

How to Print Existing PDF Pages with Excel VBA
Product
Microsoft Excel
Device & OS
not provided
Scenario
Automating a document workflow where an existing PDF document must be sent to the printer directly from an Excel macro.
Observed behavior
Excel's native ExportAsFixedFormat method only creates new PDF files from Excel worksheets; it cannot read, open, or print an already existing PDF.
Before you start

Ensure you have a default printer properly configured on your system and identify the installation path of your preferred PDF viewing application, as Excel requires external software to process and print PDF files.

Solution 1Recommended

Use VBA Shell Command with a PDF Application

The most reliable method is using VBA's Shell function to trigger the command-line printing interface of an installed PDF viewer.

Because Excel cannot natively print existing PDFs, you must call upon an external PDF program (such as Adobe Acrobat Reader or SumatraPDF) using command-line arguments. This method is fast and doesn't require complex API references.

1
Locate your PDF reader's executable path

Find the exact file path of your PDF reader's executable file (e.g., 'AcroRd32.exe' for Acrobat Reader) on your Windows system.

2
Write the Shell command in VBA

Open the VBA Editor (ALT + F11), create a new module, and use the Shell function. Construct a string that includes the PDF reader path, the print command parameter (often '/p' or '/t'), and the path to your existing PDF.

3
Execute the macro

Run your VBA macro. The Shell command will open the PDF reader in the background, send the specified document to the default printer, and execute the print job.

Use VBA Shell Command with a PDF Application
Command-Line Parameters: Command-line parameters vary by PDF application. For example, Acrobat uses '/t' to print to a specific printer and '/p' for the default printer. Specific page ranges might require specialized command-line tools.
Free Microsoft Office alternative

Streamline Your PDF and Spreadsheet Workflows with WPS Office

Why rely on complex VBA workarounds and external applications to handle basic PDF tasks? WPS Office is a powerful, lightweight alternative to Microsoft Office that combines robust Spreadsheets, Documents, Presentations, and a full-featured PDF editor in one single workspace.

  1. 1. Download and Install: Visit the official WPS website to download the free installation package for your operating system.
  2. 2. Open Your Files: Launch WPS Office and open your spreadsheets and PDFs directly in the same application using its convenient tabbed interface.
  3. 3. Manage PDFs Natively: Use the integrated WPS PDF tools to view, edit, extract, or print specific pages of your PDF files without needing complex macros.
Fully compatible with Microsoft Excel (.xls, .xlsx) and supports VBA macros.Built-in PDF editor lets you view, edit, and print PDFs natively without third-party apps.Lightweight design ensuring fast performance even on older devices.Familiar, easy-to-use interface for a seamless migration from Microsoft Office.
microsoft office alternative - wps office

Frequently Asked Questions

Can Excel's ExportAsFixedFormat method print existing PDFs?

No, the ExportAsFixedFormat method is strictly designed to export or save the current Excel workbook or worksheet as a new PDF file. It cannot interact with or print PDF files that already exist on your system.

Do I need Adobe Acrobat installed to print PDFs via VBA?

You need some form of PDF reading application installed (like Adobe Acrobat, WPS PDF, or SumatraPDF) because Excel cannot process PDF files natively. The VBA Shell command relies on these external applications to execute the print job.

How do I silently print a PDF using Excel VBA without opening the viewer?

You can often achieve a 'silent' print by using specific command-line arguments in your VBA Shell command, such as the '/h' (hidden) parameter in Adobe Reader. However, the exact parameter depends on the specific PDF software you are using.

Can I specify a page range when printing a PDF using the VBA Shell command?

Most standard PDF viewers do not support specifying a page range via basic command-line arguments. To print specific pages, you usually need to use the application's OLE/COM API (such as Adobe Acrobat's AcroExch) or a specialized command-line utility.