| Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next 1 | 1. wxAutomationObject and MsWord #2480 Posted by: 2003-08-19 17:57:52 |
Hi all,
I have a problem using wxAutomationObject with word and specifically with the method CallMethod.
In the following there is a piece of the my code.
wxVariant Res,PrintToFile,FileNameToPrint,OldPrinter; wxString loc_FileTmp=FilePath+"\\FileToPdf.tmp"; wxAutomationObject AppObject;
if (AppObject.CreateInstance("Word.Application")) {
Res=AppObject.CallMethod("Documents.Open",wxVariant(TxtChooseOrigFile->GetValue()));
OldPrinter=AppObject.GetProperty("ActivePrinter");
Res=AppObject.PutProperty("ActivePrinter",wxVariant("Fax"));
PrintToFile=wxVariant(true,"PrintToFile"); FileNameToPrint=wxVariant(loc_FileTmp,"OutputFileName");
Res=AppObject.CallMethod("ActiveDocument.Printout",PrintToFile,FileNameToPrint);
Res=AppObject.PutProperty("ActivePrinter",wxVariant(OldPrinter.GetString()));
Res=AppObject.CallMethod("ActiveDocument.Close"); Res=AppObject.CallMethod("Quit"); }
At the end of the execution of the procedure, it appears a warning: "ReleaseVariant: Unknown type".
I have noted that if I comment the lines:
Res=AppObject.CallMethod("ActiveDocument.Printout",PrintToFile,FileNameToPrint);
Res=AppObject.CallMethod("ActiveDocument.Close"); Res=AppObject.CallMethod("Quit");
the warning doesn't appear.
Could someone explain me where is the mistake?
Thanks in advance
Luca | Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next 1 |
|
|