Windows Develop Bookmark and Share   
 index > Windows Forms General > Reference Using both word 2003 and 2007.
 

Reference Using both word 2003 and 2007.

Dear All,

I wrote an application in C# which will create a report in word doc. For that I have taken the reference of Microsoft office 11.0 object library and Microsoft Word 11.0 object library because I have only Office 2003.

Now if i run the project in that machine which have 2007. Its creating a lots of problem. and showing error messages.

Is there any logic to resolve this? I would like to set the object programmetically. so that when it will find 2003 it will take the object model of 2003 and when it will find 2007, it will take the object model of 2007.

I am having a problem on this issue. Can any body send me some code snippets to resolve this issue. Help will be highly appreciated.

Regards,

Biswajit

Biswajitghosh25  Friday, May 30, 2008 11:45 AM
This is weird, it should be backward compatible, usually you use the object from the lowest version you will support (eg.: Use office 2000 if you plan to support office 2000 or newer).

I've not used your particular case but I've used Office 2000 object and worked on Office 2003 machine.
You need to be sure that you are distributing the your Word 2003 DLLs (the wrappers should be in your bin directory) along with the excutable so that they don't use office 2007 objects on the other machine.

Check the documentation for Word 2007 PIAs to see if anything has changed since previous versions, if so it will also probably state workarounds for specific problems like the ones you are having. And be sure to try this on other Office 2007 machines so you can rule out that the problem is not that particular Office instalation instead of the Office 2007 version itself.

Regards,
Fábio
Fábio Franco  Friday, May 30, 2008 12:36 PM

Fabio is right -- the PIAs have thus far remained fully forward-compatible. That means you can develop for Office 2000 or 2003 and get no problems in 2007.

I am curious if you have tried to install the application on a different computer running Office 2003 (not the development machine). I would expect that you may get the same errors as on the 2007 machine.

Let me also note that we are talking here about actually installing your compiled application on other machines, not opening up the Visual Studio project on a machine with a different version of Office. I don't know for sure, but I can imagine that doing that may cause problems.

JayStation3  Friday, May 30, 2008 2:28 PM
This is weird, it should be backward compatible, usually you use the object from the lowest version you will support (eg.: Use office 2000 if you plan to support office 2000 or newer).

I've not used your particular case but I've used Office 2000 object and worked on Office 2003 machine.
You need to be sure that you are distributing the your Word 2003 DLLs (the wrappers should be in your bin directory) along with the excutable so that they don't use office 2007 objects on the other machine.

Check the documentation for Word 2007 PIAs to see if anything has changed since previous versions, if so it will also probably state workarounds for specific problems like the ones you are having. And be sure to try this on other Office 2007 machines so you can rule out that the problem is not that particular Office instalation instead of the Office 2007 version itself.

Regards,
Fábio
Fábio Franco  Friday, May 30, 2008 12:36 PM

Fabio is right -- the PIAs have thus far remained fully forward-compatible. That means you can develop for Office 2000 or 2003 and get no problems in 2007.

I am curious if you have tried to install the application on a different computer running Office 2003 (not the development machine). I would expect that you may get the same errors as on the 2007 machine.

Let me also note that we are talking here about actually installing your compiled application on other machines, not opening up the Visual Studio project on a machine with a different version of Office. I don't know for sure, but I can imagine that doing that may cause problems.

JayStation3  Friday, May 30, 2008 2:28 PM

You can use google to search for other answers

Custom Search

More Threads

• VS 2008 and strange things
• Standardizing base windows and base modal windows
• Capture more webcam picture in one video file
• getting media files from a winform
• Focus moves to other form
• Windows Media Player Control Box Mimic
• Screen Capturing with C#
• TabControl: Hottracking disabled while mousedown?
• User Controls resizing at runtime
• Error: At least one recipient is required, but none were found.