Error: QueryInterface for interface Microsoft.Office.Interop.Word._Application failed.

Hello all,

I am working on a project that requires access to Microsoft Word Documents. The program simply opens a designated Word Document when the corresponding button is clicked.

The problem that I am having is after the installation process. The installation goes just fine, and the program executes normally, but when a button is clicked on the form, I get the following error:QueryInterface for interface Microsoft.Office.Interop.Word._Application failed. What does this error mean and how do I fix it?

The developer machine is a Windows XP Home machine with Visual Studio.NET 2003 installed along with Microsoft Office 2003. The test machines have the .NET Framework version 1.1 installed, along with XP pro and Office 2002.

I have access to the Word 10.0 and 11.0 libraries, and I have tried to use both libraries, but to no avail. I have also downloaded the Office 2002 PIA package, and that didn't help either. The program installs and runs without a hitch on the developer machine, but when transferred to the test machine, it bombs with the error above when a button is clicked.

Any help with this problem will be greatly appreciated.

Thanks in advance,

SamusAran03

[1210 byte] By [SamusAran03] at [2007-12-16]
# 1

Based on the information provided it looks as if versioning issues of the Word PIA and Microsoft Word type libraries may be the problem.

If you are going to be distributing your application to clients that have Microsoft Word 2002 installed then you either need to develop the application on a computer with Microsoft Word 2002 installed with the Office XP PIAs installed or you could also use late binding code for Microsoft Word.

The Microsoft Office type libraries provide backward compatibility meaning that if you build an application using the Word 2000 type library it will work for clients with Word 2000, Word 2002 and Word 2003. However, as you've found, if you build an automation application using a later version of Microsoft Word it may not work with earlier versions of Word.

For more information please review the following Knowledge Base article:

244167 INFO: Writing Automation Clients for Multiple Office Versions

http://support.microsoft.com/?id=244167

Regards,

Ken Laws
MSFT

This posting is provided "AS IS" with no warranties, and confers no rights.

For more information regarding Visual Studio Tools for Office 2005:

Best of Blogs: Visual Studio 2005 Tools for Office
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_2003_ta/html/odc_landvsto2005_ta.asp

Visual Studio Tools for Office Forum
http://forums.microsoft.com/msdn/ShowForum.aspx?ForumID=16

Visual Studio Tools for the Microsoft Office System
http://msdn.microsoft.com/office/understanding/vsto/default.aspx

KenLaws at 2007-9-9 > top of Msdn Tech,Visual Studio Tools for Office,Visual Studio Tools for Office...