Link to home
Start Free TrialLog in
Avatar of Amitava_Mukherjee
Amitava_MukherjeeFlag for India

asked on

Word 2003 and 2007 COM problem

I'm writing a VB.Net app which will populate an Word Document. The app references Word using COM.

I have Office 2003 and 2007 on my machine, but the machine which will be running the application will have Office 2003. Therefore, when I added the Word COM reference, I chose the Word 11 one.

Now that I'm trying the application on another machine I'm getting errors saying that the Microsoft.Office.Interop.Word version 12.0.0.0 is missing. Viewing the object browser I see that Microsoft.Office.Interop.Word is described as:

Assembly Microsoft.Office.Interop.Word
C:\WINDOWS\assembly\GAC\Microsoft.Office.Interop.Word\12.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Word.dll

This is strange condisering in the Solution Explorer view, I see the properties for the Word Reference set to:
Microsoft.Office.Interop.Word
Microsoft Excel 11.0 Object Library
C:\WINDOWS\assembly\GAC\Microsoft.Office.Interop.Word\12.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Word.dll

It's saying it's Word 11, but then references the Word 12 interop libraries. I've removed the reference and added it again and it's still the same.

Any suggestions as to how I fix this? I need to keep Office 2003 and 2007 on this machine, but need to be able to build for Word 2003.

Thanks
Avatar of Joanne M. Orzech
Joanne M. Orzech
Flag of United States of America image

So in the VBE, you go to Tools, References - click on the problem reference and have you tried just browsing to the correct one?
Avatar of Amitava_Mukherjee

ASKER

Yes, though I select "Microsoft Word 11.0 Object Library", the path is shown as "C:\WINDOWS\assembly\GAC\Microsoft.Office.Interop.Word\12.0.0.0__71e9bce111e9429c" which is the Word 2007 office related dll.
Then browse to the right one.....yes?
I selected the right one, the office 2003 dll but it refers office 2007 dll still
ASKER CERTIFIED SOLUTION
Avatar of Joanne M. Orzech
Joanne M. Orzech
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanx, problem solved, actually in developer PC if office 2003 and office 2007 both exists, .net always bind the higher version dll from GAC although user select the lower version dll, .net still refers the higher version dll by default at time of compilation. Removing the higher version office is the only solution.
Oh - well thank you for that.  I was not aware of that.
Avatar of saji1976
saji1976

Hi,

In my case, I am using VS 2005 and have both MS Office 2003 and 2007 in my machine.  I am adding a Reference 'Microsoft.Office.Interop.Word or Excel 11.0.0.0' in my project, but the path is referred to c:\windows\assembly\GAC\12.0.0.0.. folder; because of which 2007 is initiated when the application is executed, but i wan Word/Excel 2003 to be opened.  Also my requirement is both 2003 and 2007 will present on the server where the application is running.

Please let me know how to resolve this issue?

Thanks.
This may help - it tells you how to set the default version of Office when multiple versions are installed... however, it only works for Word - not Excel.

http://pubs.logicalexpressions.com/pub0009/LPMArticle.asp?ID=762