How to kill EXCEL.exe from Task Manager from Oracle Forms? [message #264739] |
Tue, 04 September 2007 06:57 |
bbaz
Messages: 138 Registered: April 2007
|
Senior Member |
|
|
I am continuously Opening and Closing and Excel Sheet in order to get specific data into my Oracle Form.
Surprisingly, I found out that whenever I am calling my procedure and running the code, an instance of EXCEL.EXE task is created in the TASK MANAGER and is not being killed/ended when I close and Quit Excel which will end up in a Memory Leakage. (If I call the excel sheet 10 times, I get 10 instances)
How can I Kill the Excel.exe after I close the Excel Sheet?
currently I am closing excel as follows:
ole2.release_obj(worksheet);
ole2.release_obj(worksheets);
ole2.release_obj(workbook);
ole2.release_obj(workbooks);
ole2.invoke(application,'Quit');
ole2.release_obj(application);
Thanks in Advance,
Baz
|
|
|
|
Re: How to kill EXCEL.exe from Task Manager from Oracle Forms? [message #264781 is a reply to message #264774] |
Tue, 04 September 2007 10:18 |
bbaz
Messages: 138 Registered: April 2007
|
Senior Member |
|
|
Thanks Sanka,
I appreciate your help. Well yes, you seem to be right about this as I have commented the line out (ole2.invoke) and still it is not making any difference.
So why is it that the:
ole2.invoke(application,'Quit');
is NOT QUITING THE EXCEL APPLICATION???
Can someone shed some light on this?
Thanks to all,
Baz
|
|
|
|
|
|
|
Re: How to kill EXCEL.exe from Task Manager from Oracle Forms? [message #266575 is a reply to message #266249] |
Tue, 11 September 2007 02:55 |
bbaz
Messages: 138 Registered: April 2007
|
Senior Member |
|
|
FINALLY, I GOT THIS RESOLVED
I hope that Others will benefit from this Post later.
From the researches I made, I found out that the EXCEL.EXE process will stay RUNNING in the Task Manager as long as there STILL EXISTS A LIVING OLE2 Object that has not been RELEASED.
In my case, although I verified like 100 times that all the OLE2 Objects I was Creating I was RELEASING at the END before QUITING the Excel Application but still this did not resolve the problem and I was always facing a Memory Leakage and the Excel.exe was still running in the background; and everytime I call my Form to Connect to Excel and get Data a New EXCEL.exe Process Instance is created in the Task Manager.
Related to this Issue, and what solved my problem is NOT USING the OLE2 OBJECT "worksheets" (note the S, worksheetS) AND I changed the EXCEL initialization and File Opening Code as follows:
-- Initialize Excel and Open the PI-Datalink Sheet (Tanks,Tags)
applic := OLE2.CREATE_OBJ('Excel.Application');
ole2.set_property(applic,'Visible','true');
workbooks := OLE2.GET_OBJ_PROPERTY(applic, 'Workbooks');
args := OLE2.CREATE_ARGLIST;
ole2.add_arg(args,'c:\oratopi.xls');
workbook := ole2.GET_OBJ_PROPERTY(workbooks,'Open',args);
ole2.destroy_arglist(args);
--worksheets := ole2.GET_OBJ_PROPERTY(workbook, 'Worksheets');
--Message('opening Worksheet and Initializing');
--worksheet := OLE2.GET_OBJ_PROPERTY(applic,'activesheet');
--OLE2.SET_PROPERTY(worksheet , 'Value','Sheet1');
args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, 'Sheet1');
worksheet:=OLE2.GET_OBJ_PROPERTY(workbook,'Worksheets',args);
OLE2.DESTROY_ARGLIST(args);
NOTE the Statements COMMENTED OUT.
The following link was very helpful:
http://forums.oracle.com/forums/thread.jspa?threadID=224129&tstart=-1
Thanks to all who tried to help.
Cheers,
Baz
|
|
|