C++ code for automation works in Word2003 and earlier not Word 200

W

WishfulDoctor

I have a C++ (native) application that is using Automation to work with MS
Word.
I have imported the type library compatible with Word97 (msword8.olb) and
use the created .h and .cpp files. I am using
CreateDispatch(L"Word.Application") which is equivalent to the late binding
in the example given in http://support.microsoft.com/kb/242375 . It works
through Word 2003, but does not work for Word2007. What is the problem? I
understood that if I used an earlier type-library I will not have this issue
(the developer originally used MSWord.olb and found that it will not work
with older versions of Word and switched to msword8.olb ).
 
C

Chris

http://blogs.msdn.com/artleo/archive/2006/03/24/560418.aspx

If you read the above blog entry it mentions that if you use the Office 2003
PIAs that they will work with versions of Office 2007 installed. You imported
the Word97 type library for building this application.

If you look here:
http://msdn2.microsoft.com/en-us/library/15s06t57(vs.80).aspx

Halfway down the list of 2007 files, you'll see a bunch of "Binding Redirect
Assembly for ..." that being with Policy.11.0.Microsoft... These are the
files that handle the redirect from the 2003 to the 2007 calls.

Redo your import and use an Office 2003 type library and I bet it works
under Office 2007.

Chris Rasco
Sr. Software Developer
Texas Scenic Company
(e-mail address removed)
 
W

WishfulDoctor

Hi Chris,

thanks for replying.

If I use the Word2003 type library, then I can no longer support Word97 (I
still have Win98 . Word97 customers) or have 2 versions of my software which
is a headached that I want to avoid.
 
C

Chris

Sounds like you'll have to maintain either a separate version for 2k7 clients
or for your 97 clients. Good luck.

Chris Rasco
Sr. Software Developer
Texas Scenic Company
(e-mail address removed)
 
W

WishfulDoctor

Thanks Chris.

After a lot of grunt work, found that only two functions had different
signatures. Added code to check installed version of Word & call the
appropriate version of the function in those instances. Seems to work so far.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top