Word Automation

U

UrbanBlues

Hello

I tried to update Word Custom properties using MFC but got a problem...

Here is the code (simplfied by removing error checking)

CString strFile = "C:\\DataSheet.doc";

WordApp.CreateDispatch( "Word.Application");

WordDocs = WordApp.GetDocuments();

WordDoc = WordDocs.Open( COleVariant( strFile, VT_BSTR), vtOptional,
vtOptional, vtOptional, vtOptional, vtOptional, vtOptional, vtOptional,
vtOptional, vtOptional, vtOptional, vtOptional, vtOptional, vtOptional,
vtOptional, vtOptional);

WordCustProps = WordDoc.GetCustomDocumentProperties();

int nCount = WordCustProps.GetCount();

At this point, a MessageBox appears with the message 'Member not Found' ....

What is strange is that I use the file MSWord.h and MSWord.cpp generated by
VC++ and that the function GetCount is described as member of
CustomProperties ... The code also fails for the other functions ...

Any idea what's wrong with that code ?

Thanks for your help


Thierry
 

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