Solved

Word 2003 and 2007 COM problem

Posted on 2009-05-10
9
554 Views
Last Modified: 2013-11-27
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
0
Comment
Question by:Amitava_Mukherjee
  • 5
  • 3
9 Comments
 
LVL 37

Expert Comment

by:Joanne M. Orzech
ID: 24357858
So in the VBE, you go to Tools, References - click on the problem reference and have you tried just browsing to the correct one?
0
 

Author Comment

by:Amitava_Mukherjee
ID: 24360874
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.
0
 
LVL 37

Expert Comment

by:Joanne M. Orzech
ID: 24367893
Then browse to the right one.....yes?
0
 

Author Comment

by:Amitava_Mukherjee
ID: 24394136
I selected the right one, the office 2003 dll but it refers office 2007 dll still
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 37

Accepted Solution

by:
Joanne M. Orzech earned 500 total points
ID: 24426027
How did you "select" it?

Have you tried unchecking the box next to the 2007 library?
0
 

Author Closing Comment

by:Amitava_Mukherjee
ID: 31580037
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.
0
 
LVL 37

Expert Comment

by:Joanne M. Orzech
ID: 24440791
Oh - well thank you for that.  I was not aware of that.
0
 
LVL 3

Expert Comment

by:saji1976
ID: 24449297
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.
0
 
LVL 37

Expert Comment

by:Joanne M. Orzech
ID: 24450842
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
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you work with Word a lot, you probably use styles. If you use styles a lot, you've probably balled your fist more often than not when working with the ribbon. In Word 2007/2010, one of the things that I find missing when using styles is a quic…
This is written from a 'VBA for MS Word' perspective, but I am sure it applies to most other MS Office components where VBA is used.  One thing that really bugs me is slow code, ESPECIALLY when it's mine!  In programming there are so many ways to…
This Micro Tutorial well show you how to find and replace special characters in Microsoft Word. This is similar to carriage returns to convert columns of values from Microsoft Excel into comma separated lists.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now