Skip to Main Content

Oracle Forms

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

trying to close an excel workbook with client_ole2 leaves an excel process

567139May 29 2007 — edited Jul 15 2007
Hello ,
I 'm trying to import data from forms (10g) to an excel workbook and i use client_ole2.
Everything seems to work fine except the last part of my code. The excel application is closing but it leaves a process open ( Windows Task Manager).The procedure I'm using
is the following

PROCEDURE fill_excel
IS
v_ole_excel client_ole2.obj_type;
v_ole_workbooks client_ole2.obj_type;
v_ole_workbook client_ole2.obj_type;
v_ole_worksheets client_ole2.obj_type;
v_ole_worksheet client_ole2.obj_type;
cell client_ole2.obj_type;
v_file_name VARCHAR2 (2000) := 'C:\F101.xls';
obj_hnd client_ole2.obj_type;
v_ole_range client_ole2.obj_type;
arglist client_ole2.list_type;
v_date_from DATE;
v_date_to_xr DATE;
v_date_to_chr VARCHAR2(20);
v_date_to DATE;

BEGIN
-- INITIALIZATION OF DATES
GET_XRISI('GEL',v_date_from,v_date_to_xr);
select iso_lib.Get_ISO_CONFIG_Value('DATEE')
into v_date_to_chr
from dual;
v_date_to:=to_date(v_date_to_chr,'DD/MM/YYYY');
-- OPEN EXCEL
v_ole_excel := client_ole2.create_obj ('Excel.Application');
client_ole2.set_property (v_ole_excel, 'visible', 0);
-- OPEN WORKBOOKS - WORKBOOK
v_ole_workbooks := client_ole2.get_obj_property (v_ole_excel, 'Workbooks');
arglist := client_ole2.create_arglist;
client_ole2.add_arg (arglist, v_file_name);
v_ole_workbook :=client_ole2.invoke_obj (v_ole_workbooks, 'open', arglist);
client_ole2.destroy_arglist (arglist);
--OPEN WORKSHEETS - WORKSHEET (1)
v_ole_worksheets := client_ole2.get_obj_property (v_ole_workbook, 'Worksheets');
arglist := client_ole2.create_arglist;
client_ole2.add_arg (arglist, 1);
v_ole_worksheet :=client_ole2.get_obj_property (v_ole_worksheets, 'Item', arglist);
client_OLE2.invoke(v_ole_worksheet,'activate');
client_ole2.destroy_arglist (arglist);
fill_cell (v_ole_worksheet, 'H6', value);

-- OPEN WORKSHEET (2)
arglist := client_ole2.create_arglist;
client_ole2.add_arg (arglist, 2);
v_ole_worksheet :=client_ole2.get_obj_property (v_ole_worksheets, 'Item', arglist);
client_OLE2.invoke(v_ole_worksheet,'activate');
client_ole2.destroy_arglist (arglist);
FILL_CELL(v_ole_worksheet,'AY2',value);
-- save document as c:\F101_xxxx.xls
arglist := client_ole2.create_arglist;
client_ole2.add_arg (arglist, 'c:\F101_'||REPLACE(v_date_to_chr,'/' ,NULL)||'.xls');
client_ole2.invoke (v_ole_workbook, 'SaveAs', arglist);
client_ole2.destroy_arglist (arglist);
-- close C:\F101.xls
arglist := client_ole2.create_arglist;
client_ole2.add_arg (arglist, v_file_name);
client_ole2.invoke (v_ole_workbook, 'Close', arglist);
client_ole2.destroy_arglist (arglist);
-- exit Excel
client_ole2.invoke (v_ole_excel, 'Quit');
--To release all the memory object
client_ole2.RELEASE_OBJ (v_ole_worksheet);
client_ole2.RELEASE_OBJ (v_ole_workbook);
client_ole2.RELEASE_OBJ (v_ole_workbooks);
client_ole2.RELEASE_OBJ (v_ole_excel);

END;
Any suggestions will be appreciated...
Thanks Marina
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 12 2007
Added on May 29 2007
7 comments
1,527 views