PDF Conversion Issues

How to Preserve Excel Worksheet Links When Creating PDFs with VBA

Nimra MalikNimra Malik Nov 3, 2026 868 views

Question details

The user wants to export Excel workbooks to PDF using VBA while keeping internal worksheet links and navigation functional.

How to Preserve Excel Worksheet Links When Creating PDFs with VBA
Product
Microsoft Excel
Device & OS
not provided
Scenario
Automating the creation of PDF documents from Excel workbooks using VBA scripts, where interactive elements like links are required in the output.
Observed behavior
Internal hyperlinks connecting different worksheets are often lost, broken, or converted to plain text in the resulting PDF file.
Before you start

Ensure that the internal hyperlinks in your Excel workbook are fully functional before running any VBA export scripts, as broken source links cannot be magically preserved in the final PDF.

Solution 1Recommended

Use the ExportAsFixedFormat Method in VBA

Using Excel's native ExportAsFixedFormat method with the correct parameters is the most reliable way to preserve both internal and external links during PDF conversion.

Many users rely on virtual PDF printers (like Microsoft Print to PDF) in their VBA scripts using the PrintOut method. However, printing inherently strips interactive elements. To retain links, you must use the native ExportAsFixedFormat method.

1
Open the VBA Editor

Press Alt + F11 in Excel to open the Visual Basic for Applications editor, and locate the module containing your export script.

2
Update the Export Method

Replace any PrintOut commands with the ExportAsFixedFormat method applied to your target Workbook or Worksheet object.

3
Configure the Parameters

Ensure your code includes 'Type:=xlTypePDF'. A basic implementation looks like: ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, Filename:="C:\path\to\file.pdf".

4
Run and Verify

Execute the macro to generate the PDF. Open the output file in a standard PDF viewer to verify that clicking the worksheet links navigates correctly.

Use the ExportAsFixedFormat Method in VBA
Important: Ensure the target worksheets referenced by your links are actually included in the exported PDF range; otherwise, internal links will have nowhere to navigate.
Seamless PDF Conversion

Export Spreadsheets to PDF with Links Intact using WPS Office

WPS Office provides highly capable built-in tools to export your spreadsheets directly to PDF while perfectly preserving all internal and external hyperlinks, bypassing complex VBA troubleshooting.

  1. 1. Open your Spreadsheet: Launch WPS Office and open the spreadsheet containing your hyperlinks.
  2. 2. Access the Export Tool: Click on 'Menu' in the top-left corner and select 'Export to PDF'.
  3. 3. Configure and Export: In the export dialog box, configure your save location and ensure the standard export options are selected. Click 'Export'.
  4. 4. Test the Links: WPS Office will automatically open the resulting file in its integrated PDF viewer so you can immediately test the working links.
Preserves internal sheet links automatically during PDF exportFully compatible with Microsoft Excel (.xlsx) formats and macrosBuilt-in advanced PDF viewer and editor for quick adjustmentsLightweight alternative with an intuitive user interface
microsoft office alternative - wps office

Frequently Asked Questions

Why do my Excel hyperlinks turn into plain text in the exported PDF?

This usually happens if your VBA script uses a virtual printer (like Microsoft Print to PDF) rather than a native exporter. Print drivers flatten the document for physical paper, stripping out interactive elements like hyperlinks.

Does ExportAsFixedFormat preserve external links as well as internal ones?

Yes, when used correctly, the ExportAsFixedFormat method in VBA preserves both internal worksheet navigation links and external web URLs.

Do I need Adobe Acrobat installed to keep VBA exported links working?

No. Using the native Excel ExportAsFixedFormat method or WPS Office's built-in PDF converter will retain the links natively without requiring Adobe Acrobat.

What if my VBA script uses the PrintOut method?

The PrintOut method sends the document to a printer driver, which typically drops hyperlinks. You must modify your VBA code to use ExportAsFixedFormat to retain interactivity.