Amitava_Mukherjee
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.W ord version 12.0.0.0 is missing. Viewing the object browser I see that Microsoft.Office.Interop.W ord is described as:
Assembly Microsoft.Office.Interop.W ord
C:\WINDOWS\assembly\GAC\Mi crosoft.Of fice.Inter op.Word\12 .0.0.0__71 e9bce111e9 429c\Micro soft.Offic e.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.W ord
Microsoft Excel 11.0 Object Library
C:\WINDOWS\assembly\GAC\Mi crosoft.Of fice.Inter op.Word\12 .0.0.0__71 e9bce111e9 429c\Micro soft.Offic e.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
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.W
Assembly Microsoft.Office.Interop.W
C:\WINDOWS\assembly\GAC\Mi
This is strange condisering in the Solution Explorer view, I see the properties for the Word Reference set to:
Microsoft.Office.Interop.W
Microsoft Excel 11.0 Object Library
C:\WINDOWS\assembly\GAC\Mi
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
So in the VBE, you go to Tools, References - click on the problem reference and have you tried just browsing to the correct one?
ASKER
Yes, though I select "Microsoft Word 11.0 Object Library", the path is shown as "C:\WINDOWS\assembly\GAC\M icrosoft.O ffice.Inte rop.Word\1 2.0.0.0__7 1e9bce111e 9429c" which is the Word 2007 office related dll.
Then browse to the right one.....yes?
ASKER
I selected the right one, the office 2003 dll but it refers office 2007 dll still
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
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.
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.
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
http://pubs.logicalexpressions.com/pub0009/LPMArticle.asp?ID=762