How to Export a Microsoft Project Network Diagram to a One-Page PDF Using VBA
Question details
The user needs to export a filtered Microsoft Project Network Diagram to a single-page PDF using VBA because the built-in macro recorder does not capture the export action.

- Product
- Microsoft Project
- Device & OS
- not provided
- Scenario
- Automating the process of filtering project critical tasks and saving the current Network Diagram view as a single-page PDF document.
- Observed behavior
- The macro recorder fails to record the file name specification and the actual PDF export command.
Ensure your Microsoft Project file is open and properly formatted, and verify that you have developer tools enabled to access the VBA Editor (Alt + F11).
Use Application.DocumentExport in Custom VBA
Write a custom VBA script bypassing the macro recorder to programmatically export the diagram.
The built-in macro recorder in Microsoft Project is limited and often fails to capture file-level actions like saving or exporting to PDF. To achieve this, you must write a custom VBA script using the Application.DocumentExport method.
Be cautious when forcing a large Network Diagram onto a single page, as the text may become too small to read. It is highly recommended to filter tasks down to the critical path or a selected task subset before running the export script.
In Microsoft Project, press Alt + F11 on your keyboard to open the Visual Basic for Applications (VBA) editor.
Click on 'Insert' in the top menu bar, then select 'Module' to create a blank script window.
Define a new sub-routine and use the Application.DocumentExport method. Specify your desired file path, name, and the PDF format extension in the parameters.
Save your code, return to your MS Project window, and run the newly created macro from the View > Macros menu to generate the PDF.

View and Edit Your Exported Project PDFs with WPS Office
While Microsoft Project manages your complex task diagrams, WPS Office is an excellent, lightweight alternative for viewing, annotating, and editing the resulting PDF files, offering seamless compatibility with all common document formats.
- 1. Download and Install: Get WPS Office for free from the official website and install it on your device.
- 2. Open the Exported PDF: Launch WPS Office and drag your newly exported Microsoft Project PDF diagram directly into the workspace.
- 3. Annotate and Share: Use the PDF Edit tab to add comments, highlight critical tasks, or merge the diagram with other project reports.

Frequently Asked Questions
Why didn't the macro recorder capture my PDF export steps?
The macro recorder in Microsoft Project is designed to record basic UI interactions. It often omits advanced file-level operations, specific dialog box selections, or Document Export methods, requiring you to write custom VBA code.
How can I make a large Network Diagram readable on a one-page PDF?
Before exporting, apply filters to show only the critical path or specific milestone tasks. Alternatively, adjust the Page Setup in MS Project to fit to 1 page wide by 1 page tall, though extensive diagrams may still appear too small.
Which VBA method is used to export a MS Project view to PDF?
You should use the Application.DocumentExport method in your VBA script. This method allows you to programmatically define the export format (such as PDF) and the destination file path.




