Board index » cppbuilder » Excel (Again) and Process Termination

Excel (Again) and Process Termination


2004-07-13 12:00:16 AM
cppbuilder37
Apologies for the duplicate post (I have already posted a
request on a different thread here, but thought it may not
get noticed towards the end of an older thread.)
I have written an ActiveX component, a requirement of which
is to export configuration data into Excel files, for
printing and other processing.
I intend to use "TExcelApplication", "TExcelWorkbook"
and "TExcelWorksheet".
I have taken example code from Adrian Carter and from
"Blue Knight". I managed to get both of these examples
working as a part of an application, but when using
either within the ActiveX component I get the same problem.
As soon as I have executed a line similar to:
xlws->ConnectTo(xlwb->Worksheets->get_Item(Variant("Sheet1")));
then I am no longer able to close down my container application.
Having spent the day trawling through the newsgroups, I see
that I am by no means alone. I see further that there seems
to be some relation between the Excel process not terminating
and my process not terminating, but so far have not found a solution.
All ideas gratefully received.
Andy
 
 

Re:Excel (Again) and Process Termination

Andy,
I've never setup the scenario you described but would like to investigate.
Is the basic idea to automate Excel from within an ActiveX control, say an
ActiveForm. As long as you explicitly invoke the 'Quit' method and release
all interfaces acquired from Excel, I would expect the latter to terminate.
However, I have not tried it out yet...
Let me know if the above summarizes your setup and I'll investigate.
Regards,
Bruneau.
 

Re:Excel (Again) and Process Termination

Sorry, Bruneau - I tried to post a response to this
yesterday, but it seems not to have appeared.
Yes - that's exactly my scenario.
Thanks for investigating. I have actually worked-around
now by creating a worker thread and accessing Excel from that.
I can probably still dig up the old code if that helps you.
Cheers
Andy
 

{smallsort}