Home » Developer & Programmer » Forms » Exporting to excel (10g devsuite and database)
Exporting to excel [message #381923] Tue, 20 January 2009 05:32 Go to next message
bechara.daccache
Messages: 14
Registered: September 2008
Location: Lebanon
Junior Member
Dear all,

Im working on a screen that contains a button that extract some unbound fields to an excel sheet.
Everything is working fine, it is extracting well using the TEXT_IO package.
But when I created a macro on my excel sheet, oracle is not extracting any data to this sheet...
And I have another problem that every time I open the excel sheet, it usually has some compatibility troubles.
Here is an example of the WHEN_BUTTON-PRESSED trigger concerning the button that extracts into excel:

declare
  MYFILE TEXT_IO.FILE_TYPE;
BEGIN
	MYFILE := TEXT_IO.FOPEN('C:\Users\bechara.daccache\Desktop\test.xls', 'a');		
      TEXT_IO.PUTF(MYFILE, get_item_property('block3.text_item8', prompt_text) || ':   ');
      TEXT_IO.PUTF(MYFILE, '	');
      TEXT_IO.PUTF(MYFILE, test	');
      TEXT_IO.PUTF(MYFILE, 'test1\n');
      TEXT_IO.PUTF(MYFILE,:block3.text_item8);
      TEXT_IO.PUTF(MYFILE, ',\n');
    TEXT_IO.FCLOSE(MYFILE);
    EXCEPTION
	WHEN NO_DATA_FOUND THEN
		TEXT_IO.FCLOSE(MYfile);

END;


And an example concerning the WHEN_BUTTON_PRESSED that opens the excel fle :

DECLARE
AppID PLS_INTEGER;
 BEGIN
 AppID := DDE.App_Begin('C:\Program Files\Microsoft Office\Office12\EXCEL'
      ||' '||'C:\Users\bechara.daccache\Desktop\test.xls',DDE.APP_MODE_MAXIMIZED);
  end;


So please if anyone can help me so I can extract into the excel sheet while it has a macro.

Best Regards,

Bechara
[EDITED by DJM: split long line]

[Updated on: Thu, 22 January 2009 00:07] by Moderator

Report message to a moderator

Re: Exporting to excel [message #382339 is a reply to message #381923] Thu, 22 January 2009 00:10 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Does this link help?
To run an excel macro
http://www.orafaq.com/forum/t/47685/67467/

David
Re: Exporting to excel [message #384129 is a reply to message #382339] Mon, 02 February 2009 04:12 Go to previous messageGo to next message
bechara.daccache
Messages: 14
Registered: September 2008
Location: Lebanon
Junior Member
Dear little foot,

The Macro worked just fine,
I used:

DDE.EXECUTE(Conv_ID,'[RUN("Macro1")]',10000);
to run the macro after opening the excel sheet.

Thanks anyway,

Regards,

Bechara
Re: Exporting to excel [message #384138 is a reply to message #381923] Mon, 02 February 2009 05:15 Go to previous messageGo to next message
SUHAS22845
Messages: 51
Registered: August 2008
Location: BANGALORE
Member

Dear Becharra,

Even am looking for a code, which exports data to an excel sheet, can u please share your code with me, beacuse the code which i am using is working fine, but the problem am facing is that, when ever a null value in any column is enocuntered, the forms execution stops. Sad. Please share your code, so that i can try out things at my end.
Re: Exporting to excel [message #385616 is a reply to message #384138] Tue, 10 February 2009 04:50 Go to previous message
bechara.daccache
Messages: 14
Registered: September 2008
Location: Lebanon
Junior Member
Dear all and SUHAS22845 Wink ,

I attached the fmb of a test form that i created that contains some buttons and some examples of the code I used to extract to excel, add columns, save and run a macro.
Hope it will be useful.

Regards,

Bechara
Previous Topic: please help me
Next Topic: how to load the data from Excel to the Oracle database
Goto Forum:
  


Current Time: Fri Apr 26 02:23:11 CDT 2024