OLE2 - Excel crashing after exit.. need a little help please gurus [message #174095] |
Thu, 25 May 2006 19:28 |
chetwyn
Messages: 73 Registered: December 2005
|
Member |
|
|
Hi guys. I have an excel sheet im reading in, it's working fine untill I close the excel sheet(the form is still open at this point). As soon as I colse the excel sheet I get this message:
"Excel has genersate error and will be closed by Windows. You will need to restart the program".
I just can't seem to figure it out how to stop it. Here's the code I'm using:
DECLARE
appl OLE2.OBJ_TYPE;
workbooks OLE2.OBJ_TYPE;
workbook OLE2.OBJ_TYPE;
worksheet OLE2.OBJ_TYPE;
worksheets OLE2.OBJ_TYPE;
args OLE2.LIST_TYPE;
cell ole2.obj_type;
cell_value VARCHAR2(2000);
name_var VARCHAR2(2000);
name VARCHAR2(2000);
rows INTEGER;
column INTEGER;
BEGIN
appl := OLE2.CREATE_OBJ('Excel.Application');
OLE2.SET_PROPERTY(appl, 'Visible', 'True');
args := OLE2.CREATE_ARGLIST;
ole2.add_arg(args, 'C:\test\t.xls');
workbooks := OLE2.GET_OBJ_PROPERTY(appl, 'Workbooks');
workbook := ole2.GET_OBJ_PROPERTY (workbooks, 'Open', args);
ole2.destroy_arglist(args);
args := OLE2.CREATE_ARGLIST;
ole2.add_arg(args,'Sheet1');
worksheet := ole2.GET_OBJ_PROPERTY(workbook,'Worksheets',args);
ole2.destroy_arglist(args);
rows := 1;
column := 1;
for rows in 1..4 loop
for column in 1..3 loop
args := OLE2.CREATE_ARGLIST;
ole2.add_arg(args,rows); -- moves across column.
ole2.add_arg(args,column); -- moves across column.
cell := ole2.GET_OBJ_PROPERTY(worksheet,'Cells',args);
ole2.destroy_arglist(args);
name_var := ole2.get_char_property(cell,'Value');
-- message('name: '||name_var);
end loop;
end loop;
ole2.release_obj(cell);
ole2.release_obj(worksheet);
ole2.release_obj(workbook);
ole2.release_obj(workbooks);
ole2.release_obj(appl);
ole2.invoke(appl, 'Quit');
END;
Any help would be GREAT!
[Updated on: Thu, 25 May 2006 19:29] Report message to a moderator
|
|
|
|