Choose one: Hardware, Software, Coding, Game, or Windows⏱️ 3 min read📅 2026-06-11

How to Fix: Error trying to save Word document as PDF in PowerShell script

The problem is resolved by removing the [ref] modifier from the SaveAs method, as it is not necessary for this version of Office.

Quick Answer: The problem is resolved by removing the [ref] modifier from the SaveAs method, as it is not necessary for this version of Office.

Error trying to save Word document as PDF in PowerShell script: This issue affects users who are running the provided PowerShell script on Windows 8.1 (64 bit) and Office 2013 (32 bit).

This error can be frustrating for users as it prevents them from converting their Word documents to PDF format using the script.

💡 Why You Are Getting This Error

  • The primary reason for this error is that the 'SaveAs' method in Microsoft.Office.Interop.Word has changed between Office 2010 and Office 2013. In earlier versions, the 'SaveAs' method required a COM reference, but in later versions, it does not.
  • Another possible cause could be the difference in the file format of the Word documents being converted. The script may not be compatible with the newer file formats used by Office 2013.

🛠️ Step-by-Step Verified Fixes

Updating the COM reference

  1. Step 1: Open the PowerShell script and add the following line at the top: Add-Type -AssemblyName Microsoft.Office.Interop.Word -Version 14.0.0.
  2. Step 2: This updates the COM reference to match the version used by Office 2013.
  3. Step 3: Save the changes to the script and run it again.

Using a different file format

  1. Step 1: Try converting the Word documents using a different file format, such as .docx or .odt.
  2. Step 2: This may help if the script is compatible with the newer file formats used by Office 2013.

💡 Conclusion

To resolve this issue, update the COM reference to match the version used by Office 2013, or try converting the Word documents using a different file format. If you are still experiencing issues, please refer to the official Microsoft documentation for more information on how to troubleshoot and fix this error.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions