Home » Developer & Programmer » Reports & Discoverer » code not working
code not working [message #409809] Wed, 24 June 2009 02:56 Go to next message
sunil.madnani
Messages: 36
Registered: March 2007
Location: BHILAI
Member
Hello All,
i want to populate data on specific excel and on specific sheet using ole2 object.
It is going to exception

/****************************************************************
Begin
application OLE2.OBJ_TYPE;
workbooks OLE2.OBJ_TYPE;
workbook OLE2.OBJ_TYPE;
worksheet OLE2.OBJ_TYPE;
cell OLE2.OBJ_TYPE;
FormulaCell OLE2.OBJ_TYPE;
BlankCell OLE2.OBJ_TYPE;
args ole2.OBJ_TYPE;

vCellAddress Varchar2(100);
vFormulaResult Varchar2(100);
IsBlank Varchar2(20);
IsText Varchar2(20);
vValue Varchar2(20);

Begin
application := OLE2.CREATE_OBJ('Excel.Application');
ole2.set_property(application,'Visible','false');
workbooks := OLE2.GET_OBJ_PROPERTY(application, 'Workbooks');

args := OLE2.CREATE_ARGLIST;
ole2.add_arg(args,'D:\test.xls');
workbook := ole2.GET_OBJ_PROPERTY(workbooks,'Open',args);
ole2.destroy_arglist(args);


args := OLE2.CREATE_ARGLIST;
ole2.add_arg(args,'Sheet2');
worksheet := ole2.GET_OBJ_PROPERTY(application,'ActiveSheet');
ole2.destroy_arglist(args);

Exception
when others then
srw.Message(50,sqlerrm||'Error in opening Excel file ..!');
End;

Regards;
Sunil Madnani
Re: code not working [message #409994 is a reply to message #409809] Wed, 24 June 2009 14:55 Go to previous message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
It is going to exception
Would you mind to share the error you got?
Previous Topic: Discoverer and .CSV
Next Topic: report is not printing all information
Goto Forum:
  


Current Time: Thu Mar 28 04:50:14 CDT 2024