Author | Topic: excel | |
---|---|---|
Jorge L | excel on Sun, 01 Feb 2009 11:55:03 -0300 Hello to all i have this problem with excel i generate a report to excel..., then, the the user want to open this report and excel not open, i must open the task manager and down the excel process, then excel open normaly are any posibility to close the excel that getobject() (or createobject ) opened ?, or how i must to do, to open excel, generate report and close it from memory ? PF : the method :destroy(), not close excel.exe from memory regards | |
Rodd Graham | Re: excel on Mon, 02 Feb 2009 05:20:20 +0000 Hello Jorge, > i have this problem with excel > > i generate a report to excel..., then, the the user want to open this > report and excel not open, i must open the task manager and down the > excel process, then excel open normaly > > are any posibility to close the excel that getobject() (or > createobject ) opened ?, or how i must to do, to open excel, generate > report and close it from memory ? > > PF : the method :destroy(), not close excel.exe from memory MS Office automation via COM can be a little tricky. It requires that you clean up and close the application using the COM methods before you release the COM object reference or the process persists (as you have seen). It takes some practice to master the Office object model (of which I am only a hack). Here is a starting point: http://support.microsoft.com/kb/222101 Best to look for VBS script examples on the internet (since you are not likely to find Xbase++ COM examples) which you can run without complation via the windows scripting host. Once you have a working VBS script sequence, you should be able to translate it to Xbase++ COM automation without too much difficulty. Alternatively, you might get better COM support by using Xbase++ COM automation to embed the microsoft scripting host in your Xbase++ application. Then you can build mixed language Xbase++ applications with embedded VBS or JS script. Also don't forget source\samples\activex\msexcel included with Xbase++. I have no idea what it does or how good it is, but at least somebody at Alaska did some testing and created a sample. Regards, Rodd Graham, Consultant Graham Automation Systems, LLC |