DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: Forms to Excel Data transfer

Hybrid View

  1. #1
    Join Date
    Sep 2001
    Location
    UK
    Posts
    45

    Forms to Excel Data transfer

    Hi,

    I have an application which requires data to be transferred from forms to Excel. The problem Iam facing is after the data transfer
    Excel prompts me to save the changes .
    It should automatically save and close the excel file

    The follg is the code
    DECLARE
    appid PLS_INTEGER;
    convid PLS_INTEGER;
    docid PLS_INTEGER;
    conv_established BOOLEAN := FALSE;
    buffer CHAR(100);
    ctr number(10):=0;
    l_ctr number(10):=0;
    row_col1 varchar2(10);
    row_col2 varchar2(10);
    filename varchar2(100);

    BEGIN



    APPID := DDE.APP_BEGIN('D:\MSOFFICE\office\excel.EXE',
    DDE.APP_MODE_MINIMIZED);


    WHILE NOT conv_established LOOP
    BEGIN
    convid := DDE.INITIATE('excel', 'system');
    conv_established := TRUE;
    EXCEPTION
    WHEN DDE.DMLERR_NO_CONV_ESTABLISHED THEN
    conv_established := FALSE;
    END; -- loop
    END LOOP;

    filename := 'D:\today.xls';
    DDE.EXECUTE(convid, '[Save.As("' || filename || '")]', 10000);


    docid := DDE.INITIATE('excel', 'D:\today.xls');
    ctr :=2;
    go_block('block1');
    last_record;
    l_ctr :=:system.cursor_record;
    first_record;
    loop
    row_col1 :='R'||CTR||'C1';
    row_col2 :='R'||CTR||'C2';

    DDE.POKE(docid, row_col1, :f1, DDE.CF_TEXT, 10000);
    DDE.POKE(docid, row_col2, :f2, DDE.CF_TEXT, 10000);
    ctr := ctr + 1;
    if ctr -l_ctr =2
    then exit;
    end if;
    next_record;
    end loop;



    DDE.TERMINATE(docid);

    DDE.TERMINATE(convid);
    DDE.APP_END(appid);

    /* Handle exceptions */
    EXCEPTION
    WHEN DDE.DDE_APP_FAILURE THEN
    MESSAGE('WINDOWS APPLICATION CANNOT START.');
    WHEN DDE.DDE_PARAM_ERR THEN
    MESSAGE('A NULL VALUE WAS PASSED TO DDE');
    WHEN DDE.DMLERR_NO_CONV_ESTABLISHED THEN
    MESSAGE('DDE CANNOT ESTABLISH A CONVERSATION');
    WHEN DDE.DMLERR_NOTPROCESSED THEN
    MESSAGE('A TRANSACTION FAILED');

    /* End of trigger */
    END;

    Thanks in advance

  2. #2
    Join Date
    Nov 2002
    Location
    Geneva Switzerland
    Posts
    3,142
    Don't you just need a "Save" after the Poke loop?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width