Discussion:
MS Word automation
(too old to reply)
Bob Altman
2009-07-31 20:20:37 UTC
Permalink
Not sure if this is the correct NG for this question, but it's close...

We have an existing managed app that was written to work with the COM object
model exposed by Office 2003. The app uses .Net magic to get what appears
to be managed references to the following COM libraries (as shown on the
References page):

Microsoft Excel 12.0 Object Library, version 1.3.0.0
Microsoft Office 10.0 Object Library, version 2.2.0.0
Microsoft Visual Basic for Applications Extensibility..., version 5.3.0.0
OLE Automation, version 2.0.0.0

The developer of this application has since upgraded to Office 2007, and now
(to noone's great surprise) the project doesn't build. The first couple of
errors in the Error List are:

There are updated customer wrappers available for Excel, Microsoft,
Office, Core

The actual errors that prevent compilation are that VS can no longer resolve
references to Excel.Workbooks, Excel.Worksheet, etc.

So, here's the question: Some customers still use Office 2003, while some
customers have upgraded to Office 2007. Is there some way that we can
update the project so that it works with either version of Office?

TIA - Bob
Bob Altman
2009-07-31 21:05:43 UTC
Permalink
Never mind... We took the old app (built with the Office 2003 PIA magic)
and it works on a PC with Office 2007. So we told VS to use the updated
custom wrappers, added the magic "Microsoft.Office.Interop" prefix before
all of the existing "Excel" object references (as suggested by Visual
Studio's "let me help you correct the problem" feature), and now it works
with Office 2007. We still need to take the app and try running it on a PC
with Office 2003, but I suspect that the interop magic will work. If it
doesn't then, as the Governator (Arnold) says, "I'll be back"...

Bob

Loading...