Word automation problem with office 2003

S

Subhash Badri

Hello,
I am using word automation object for converting a doc to postscript file
by using printout API word document object. this is working perfectly with
office 2000, but with office 2003 I get an error saying "Cannot Activate
Application".

The code is below:
if (oAWord.CreateDispatch("Word.Application"))
{
WrdDocuments documents(oAWord.GetDocuments());
_WrdDocument document(
documents.Open(COleVariant(szDocNameWithPath,VT_BSTR)
, covFalse, covFalse, covFalse, covOptional,
covOptional, covFalse, covOptional
, covOptional, covOptional));
oAWord.SetVisible(false);
oAWord.SetWindowState((long)2);
oAWord.Activate();
document.PrintOut(covFalse, // Background.
covOptional, // Append.
covOptional, // Range.
COleVariant(szOutputFileName,VT_BSTR),
// OutputFileName.
covOptional, // From.
covOptional, // To.
covOptional, // Item.
COleVariant((long)1), // Copies.
covOptional, // Pages.
covOptional, // PageType.
covTrue, // PrintToFile.
covOptional, // Collate.
covOptional, // ActivePrinterMacGX.
covOptional); // ManualDuplexPrint.
oAWord.Quit(covFalse, covOptional, covOptional);
oAWord.ReleaseDispatch();
oAWord.DetachDispatch();
}

Please let me know if there is any good link where i can get some help on
this.

Regards,
Subhash Badri
 

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