logo
search
Office Settings & Configuration

How to Enable Word Compatibility Mode Programmatically in VB.NET or C#

Aamir Naveed AkramAamir Naveed Akram Sep 28, 2026 868 views

Question details

The user wants to configure Microsoft Word's compatibility mode settings programmatically when saving a document via VB.NET, C#, or Word automation.

How to Enable Word Compatibility Mode Programmatically in VB.NET or C#
Product
Microsoft Word
Device & OS
not provided
Scenario
Automating Word document generation and needing to ensure the saved file behaves correctly for users on older versions of Microsoft Word.
Observed behavior
The user needs to enforce a specific document compatibility mode programmatically without relying on manual user intervention in the Word UI.
Before you start

Ensure you have the Microsoft.Office.Interop.Word library referenced in your Visual Studio project and identify the exact Word version you need the document to be compatible with.

Solution 1Recommended

Set Compatibility Mode via the SaveAs2 Method

Utilize the SaveAs2 method in the Word Interop Object Model to explicitly set the compatibility mode during the save process.

When using COM automation to manipulate Word documents in C# or VB.NET, you can dictate the compatibility mode by passing the correct WdCompatibilityMode enumeration to the SaveAs2 method. This ensures older formatting features are maintained.

1
Reference the Interop Library

In Visual Studio, add a COM reference to 'Microsoft Word Object Library' (Microsoft.Office.Interop.Word) to your VB.NET or C# project.

2
Initialize Application and Document

Instantiate the Word Application object and create or open a Document object in your code.

3
Apply SaveAs2 with CompatibilityMode

Call the Document.SaveAs2 method and assign your desired version (e.g., WdCompatibilityMode.wdWord2010) to the CompatibilityMode parameter.

4
Execute and Test

Run your application to save the document, then open it manually to verify that 'Compatibility Mode' appears in the title bar.

Set Compatibility Mode via the SaveAs2 Method
Use SaveAs2 Instead of SaveAs: The older SaveAs method does not support the CompatibilityMode parameter. Always use Document.SaveAs2 in newer automation projects.
Free Microsoft Office alternative

Switch to WPS Office for Seamless Document Compatibility

Developing automation scripts for Microsoft Word can be complex and version-dependent. WPS Office offers a free, lightweight alternative with native compatibility for Microsoft Office formats, reducing the headache of managing version-specific compatibility modes.

Highly compatible with Microsoft Word (.docx), Excel, and PowerPoint formatsLightweight application that avoids the heavy overhead of older MS Office versionsFree to use with a familiar, easy-to-learn user interfaceEliminates complex compatibility scripting across fragmented user environments
QA img-9

Frequently Asked Questions

What is the WdCompatibilityMode enumeration?

The WdCompatibilityMode enumeration is a set of constants in the Word Object Model that specifies the exact version of Microsoft Word the document should be optimized for, such as Word 2003, 2007, 2010, or 2013.

Can I use Document.SetCompatibilityMode instead of SaveAs2?

Yes, you can use the Document.SetCompatibilityMode method to upgrade or set the document's compatibility before saving, but passing the parameter directly into SaveAs2 is often safer for creating new files programmatically.

Why isn't my VB.NET code recognizing the SaveAs2 method?

This usually means you are referencing an older version of the Microsoft Word Object Library (prior to Word 2010). Ensure you have referenced version 14.0 or higher of the Interop assemblies.