Solved

Word 2003 and 2007 COM problem

Posted on 2009-05-10
9
556 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

Author Comment

by:Amitava_Mukherjee
ID: 24394136
I selected the right one, the office 2003 dll but it refers office 2007 dll still
0
 
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

The Selection object is designed for user interaction. It has a Range property, so it can be used in most places that a Range object can. Recorded macros must use the Selection because they are simply copying what the user is doing. A Range prope…
I would like to show you some basics you can do with Mailings in MS Word. It´s quite handy feature you can use for creating envelopes, labels, personalized letters etc. First question could be what is this feature good for? Mailing can really he…
In this video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …
This video teaches the viewer how to align pictures around text while keeping the text properly aligned in the document.

770 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