OLE2.CREATE_OBJ

I have been investigating the use of OLE within Forms 9i .
The document 'Oracle9i Forms:Features Obsolescence
Statement of Direction April 2002' advises that programmatic OLE interaction will be
supported with external OLE servers on the middle tier (on Windows
platforms only). That is, you may use the OLE built-ins in Forms to make
calls to an externally activated OLE server, which runs on the middle
tier.
Also the following question was discussed in a FAQ forum on Technet.
Oracle Technology Network > Products > Oracle9i Forms >
Oracle9i Application Server Release 1 Forms Services Technical FAQ
September 2001.
Q. When running a form on the Web, can I use OLE to talk to programs such
as MS Word or Excel?
Answer
Yes. OLE integration works for external OLE servers invoked using
OLE2.CREATE_OBJ. The OLE server you are invoking must be available on
the middle tier machine where the Forms Services resides. Consequently
the middle tier machine must be a Windows NT or Windows 2000 machine.
Embedded OLE containers and ActiveX (OCX) controls are not supported
when running on the Web.
However, on having a hunt through the Forms 9i Developer Reference,
there is no reference to the OLE2.CREATE_OBJ builtin or other mechanisms for
interacting with an OLE server.
Can anyone advise ?
Thanks, Pat

The OLE2 package is a common package shared by Forms and Reports, unfortunatly these sections of the help where missed out in the 9i help and there is an outstanding but to correct that.
If you have 6i then the doc is all in the help for 6i.

Similar Messages

  • Problem entering values in table after creating it in Word using OLE2

    Hi,
    I want to create a Word document from a Oracle Forms 6i application. The document will have standard text followed by a table. The cells of this table are to be populated from fields in the Forms application.
    I have created a sample code below. When executed from within the Forms application, it creates a document fine. It writes the text "Hello World". It then creates a table as expected. But when I try to enter a value "Cell Value" in the table, the value does not get written to the cell of the table. Instead it writes the value outside the table.
    Can someone please tell me what I am doing wrong here and what I need to do so that after writing the text on the document I can write values into the table also.
    Any help will be much appreciated.
    Here is the code(it works but then it doesn't ):
    PROCEDURE TEST_PROC IS
    hApplication OLE2.OBJ_TYPE;
    hDocuments OLE2.OBJ_TYPE;
    hDocument OLE2.OBJ_TYPE;
    hSelection OLE2.OBJ_TYPE;
    hParagraphFormat OLE2.OBJ_TYPE;
    hRange OLE2.OBJ_TYPE;
    hFont OLE2.OBJ_TYPE;
    hTables OLE2.OBJ_TYPE;
    hTable OLE2.OBJ_TYPE;
    args OLE2.LIST_TYPE;
    wdAlignParagraphLeft CONSTANT number(3) := 0; --Default
    wdword9tablebehavior CONSTANT NUMBER (5) := 1;
    wdautofitfixed CONSTANT NUMBER (5) := 0;
    ---- wdUnits Class members
    wdcharacter CONSTANT NUMBER (5) := 1;
    wdmove CONSTANT NUMBER (5) := 0; --Default
    --wdBorderType Class members
    wdborderleft CONSTANT NUMBER := -2;
    wdborderright CONSTANT NUMBER := -4;
    wdbordertop CONSTANT NUMBER := -1;
    wdborderbottom CONSTANT NUMBER := -3;
    --WdLineStyle Class member
    wdlinestylenone CONSTANT NUMBER := 0;
    BEGIN
    hApplication:=OLE2.CREATE_OBJ('Word.Application');
    OLE2.SET_PROPERTY(hApplication, 'Visible', 1);
    hDocuments := OLE2.GET_OBJ_PROPERTY(hApplication, 'Documents');
    hDocument := OLE2.INVOKE_OBJ(hDocuments, 'Add');
    hSelection := OLE2.GET_OBJ_PROPERTY(hApplication, 'Selection');
    hFont := OLE2.GET_OBJ_PROPERTY(hSelection, 'Font');
    OLE2.SET_PROPERTY(hFont, 'Name', 'Calibri');
    OLE2.SET_PROPERTY(hFont, 'Size', 11);
    OLE2.SET_PROPERTY(hFont, 'Bold', FALSE );
    OLE2.INVOKE(hSelection, 'TypeParagraph');
    hParagraphFormat := OLE2.GET_OBJ_PROPERTY(hSelection, 'ParagraphFormat');
    OLE2.SET_PROPERTY(hParagraphFormat, 'Alignment', wdAlignParagraphLeft);
    OLE2.RELEASE_OBJ(hParagraphFormat);
    args := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(args, 'Hello World');
    OLE2.INVOKE(hSelection, 'TypeText', args);
    OLE2.DESTROY_ARGLIST(args);
    OLE2.INVOKE(hSelection, 'TypeParagraph');
    htables := ole2.get_obj_property (hdocument, 'Tables');
    hrange := ole2.get_obj_property (hselection, 'Range');
    args := ole2.create_arglist;
    ole2.add_arg_obj (args, hrange); --Range
    ole2.add_arg (args, 1); --NumRows
    ole2.add_arg (args, 6); --NumColumns
    ole2.add_arg (args, wdword9tablebehavior); --DefaultTableBehavior
    ole2.add_arg (args, wdautofitfixed); --FitBehavior
    htable := ole2.invoke_obj (htables
    ,'Add'
    ,args
    args := ole2.create_arglist;
    ole2.add_arg (args, wdcharacter);
    ole2.add_arg (args, 1);
    ole2.add_arg (args, wdmove);
    ole2.invoke (hselection
    ,'MoveLeft'
    ,args
    ole2.destroy_arglist (args);
    args := ole2.create_arglist;
    ole2.add_arg (args, 'CellValue');
    ole2.invoke (hselection
    ,'TypeText'
    ,args
    ole2.destroy_arglist (args);
    ole2.RELEASE_OBJ (happlication);
    ole2.RELEASE_OBJ (hdocuments);
    ole2.RELEASE_OBJ (hdocument);
    ole2.RELEASE_OBJ (hfont);
    ole2.RELEASE_OBJ (hparagraphformat);
    ole2.RELEASE_OBJ (htables);
    ole2.RELEASE_OBJ (hrange);
    END;

    Once again thanks for the help John. Unfortunately I cannot use only bookmarks, because the text to be entered from the application is of undetermined length and therefore since the possibility of wrapping exists, it would not be able to give me the same formatting abilty as using a table.
    However, the good news is that I have been able to find the solution. I am posting my code here so that it is available to anyone else who might have the same issue. Thanks again.
    Here is my code and my comments in it explain what it does.
    PROCEDURE extract_to_word
    IS
    /* First of all I would like to acknowledge the help I have got from experts who have posted a lot of this code on the web which I have used here. Special thanks go to someone by the name of sfvb
    found here http://www.tek-tips.com/userinfo.cfm?member=sfvbsfvb
    This procedure does the following:
    1. Opens a word document.
    2. Creates a header and pastes a picture in the header e.g your company logo with address. Please note that the image should have both the address and the logo in it. It can be created using paint where you can write your address at one end and paste a bmp or jpg picture of your logo at the other end.
    3. Writes text with specified font and size. It calls a separate procedure PRINT_LINE to do this.
    4. Creates a table on the document with specified number of columns with fixed width.
    5. Populates the cells of the table-
    first with headers written by calls to WRITE_HEADINGS procedure.
    next with data from a block of the Forms application by calls to WRITE_DATA procedure
    6. Comes out of the table and continues to write text.
    The three procedures that are repeatedly called are described after the end of this procedure.
    Note: While I have made every attempt to ensure that the code does not generate error on account of my writing the explanatory notes, I cannot be sure of having made some typos. If the code does not compile, it is most probably be on account of something I have missed in entering the comments and explanation.
    Disclaimer:
    I am not the sole author of this code. I have taken help from other open sources and copyright infringement if any is entirely unintentional.
    happlication ole2.obj_type;
    hwindow ole2.obj_type;
    hpane ole2.obj_type;
    hview ole2.obj_type;
    hdocuments ole2.obj_type;
    hdocument ole2.obj_type;
    hselection ole2.obj_type;
    hparagraphformat ole2.obj_type;
    hrange ole2.obj_type;
    hfields ole2.obj_type;
    hfont ole2.obj_type;
    hinlineshapes ole2.obj_type;
    hpars ole2.obj_type;
    hpar ole2.obj_type;
    htabstops ole2.obj_type;
    hactivedocument ole2.obj_type;
    htables ole2.obj_type;
    htable ole2.obj_type;
    hcolumns ole2.obj_type;
    hcells ole2.obj_type;
    hrows ole2.obj_type;
    hshading ole2.obj_type;
    hinsertrow ole2.obj_type;
    hborders ole2.obj_type;
    hshading ole2.obj_type;
    args ole2.list_type;
    wdalignparagraphleft CONSTANT NUMBER (3) := 0;
    wdalignparagraphcenter CONSTANT NUMBER (3) := 1;
    wdalignparagraphright CONSTANT NUMBER (3) := 2;
    wdseekcurrentpageheader CONSTANT NUMBER (3) := 9;
    wdseekcurrentpagefooter CONSTANT NUMBER (3) := 10;
    wdseekmaindocument CONSTANT NUMBER (3) := 0;
    wdfieldpage CONSTANT NUMBER (3) := 33;
    wdfieldnumpages CONSTANT NUMBER (3) := 26;
    wdpagebreak CONSTANT NUMBER (3) := 7;
    wdstory CONSTANT NUMBER (3) := 6;
    wdword CONSTANT NUMBER (5) := 2;
    wdsentence CONSTANT NUMBER (5) := 3;
    wdword8tablebehavior CONSTANT NUMBER (5) := 0;
    wdword9tablebehavior CONSTANT NUMBER (5) := 1;
    wdautofitcontent CONSTANT NUMBER (5) := 1;
    wdautofitfixed CONSTANT NUMBER (5) := 0;
    wdautofitwindow CONSTANT NUMBER (5) := 2;
    wdunderlinesingle CONSTANT NUMBER (5) := 1;
    ---- wdUnits Class members
    wdcell CONSTANT NUMBER (5) := 12;
    wdcharacter CONSTANT NUMBER (5) := 1;
    wdword CONSTANT NUMBER (5) := 2;
    wdsentence CONSTANT NUMBER (5) := 3;
    wdline CONSTANT NUMBER (5) := 5;
    ---- wdMovementType Class members
    wdextend CONSTANT NUMBER (5) := 1;
    wdmove CONSTANT NUMBER (5) := 0;
    --wdBorderType Class members
    wdborderleft CONSTANT NUMBER := -2;
    wdborderright CONSTANT NUMBER := -4;
    wdbordertop CONSTANT NUMBER := -1;
    wdborderbottom CONSTANT NUMBER := -3;
    --WdLineStyle Class member
    wdlinestylenone CONSTANT NUMBER := 0;
    mytab CONSTANT VARCHAR2 (1) := CHR (9);
    myblue CONSTANT NUMBER (8) := 16711680; --FF0000
    mygreen CONSTANT NUMBER (8) := 65280; --00FF00
    myred CONSTANT NUMBER (8) := 255; --0000FF
    mydkgreen CONSTANT NUMBER (8) := 32768; --008000
    myblack CONSTANT NUMBER (8) := 0; --000000
    mytext VARCHAR2 (2000);
    BEGIN
    happlication := ole2.create_obj ('Word.Application');
    ole2.set_property (happlication
    ,'Visible'
    ,1
    hdocuments :=
    ole2.get_obj_property (happlication, 'Documents');
    hdocument := ole2.invoke_obj (hdocuments, 'Add');
    -------- Create Header and Footer --------
    hwindow :=
    ole2.get_obj_property (happlication, 'ActiveWindow');
    hpane := ole2.get_obj_property (hwindow, 'ActivePane');
    hview := ole2.get_obj_property (hpane, 'View');
    ---- Header Section ---
    ole2.set_property (hview
    ,'SeekView'
    ,wdseekcurrentpageheader
    hselection :=
    ole2.get_obj_property (happlication, 'Selection');
    hfont := ole2.get_obj_property (hselection, 'Font');
    ole2.set_property (hfont
    ,'Name'
    ,'Calibri'
    ole2.set_property (hfont
    ,'Size'
    ,10
    ole2.set_property (hfont
    ,'Bold'
    ,FALSE
    ole2.set_property (hfont
    ,'Color'
    ,myblack
    ole2.RELEASE_OBJ (hfont);
    args := ole2.create_arglist;
    --Below is the location of your jpg file that contains the logo and address
    ole2.add_arg (args, 'C:\temp\AMHeader2.jpg');
    hinlineshapes :=
    ole2.get_obj_property (hselection, 'InlineShapes');
    ole2.invoke (hinlineshapes
    ,'AddPicture'
    ,args
    ole2.destroy_arglist (args);
    ole2.RELEASE_OBJ (hinlineshapes);
    ole2.set_property (hview
    ,'SeekView'
    ,wdseekmaindocument
    ole2.RELEASE_OBJ (hview);
    ole2.RELEASE_OBJ (hpane);
    ole2.RELEASE_OBJ (hwindow);
    -------- Insert Text --------
    hfont := ole2.get_obj_property (hselection, 'Font');
    ole2.set_property (hfont
    ,'Name'
    ,'Calibri'
    ole2.set_property (hfont
    ,'Size'
    ,9
    ole2.set_property (hfont
    ,'Bold'
    ,FALSE
    ole2.set_property (hfont
    ,'Color'
    ,myblack
    ole2.invoke (hselection, 'TypeParagraph');
    hparagraphformat :=
    ole2.get_obj_property (hselection, 'ParagraphFormat');
    ole2.set_property (hparagraphformat
    ,'Alignment'
    ,wdalignparagraphleft
    ole2.RELEASE_OBJ (hparagraphformat);
    print_line (hselection
    , 'Date ' || TO_CHAR (TRUNC (SYSDATE), 'MM/DD/YYYY')
    ,NULL
    print_line (hselection
    ,NULL
    --The following prints the address of the recipient of the letter.
    print_line (hselection
    ,addr_line1
    ,NULL
    print_line (hselection
    ,addr_line2
    ,NULL
    print_line (hselection
    ,addr_line3
    ,NULL
    print_line (hselection
    ,addr_line4
    ,NULL
    print_line (hselection
    ,addr_line5
    ,NULL
    --Call like the one below are to insert blank lines
    hselection :=
    ole2.get_obj_property (happlication, 'Selection');
    print_line (hselection
    ,NULL
    ,NULL
    print_line (hselection
    ,'Your salutation'
    ,NULL
    print_line (hselection
    ,NULL
    ,'NULL
    print_line (hselection
    ,'Ref: '
    ,NULL
    print_line (hselection
    ,NULL
    ,NULL
    print_line
    (hselection
    ,'Whatever text you want to appear on this line.'
    ,NULL
    print_line (hselection
    ,NULL
    ,NULL
    -------- Create Table --------
    htables := ole2.get_obj_property (hdocument, 'Tables');
    hrange := ole2.get_obj_property (hselection, 'Range');
    args := ole2.create_arglist;
    ole2.add_arg_obj (args, hrange); --Range 
    ole2.add_arg (args, 1); --NumRows    The rest of the rows are created later as and when required
    ole2.add_arg (args, 6); --NumColumns This creates a table of 6 columns.
    ole2.add_arg (args, wdword9tablebehavior); --DefaultTableBehavior
    ole2.add_arg (args, wdautofitfixed); --FitBehavior
    htable := ole2.invoke_obj (htables
    ,'Add'
    ,args
    ole2.destroy_arglist (args);
    -- [Borders removal start]The following piece of code removes all the borders. Use of this is optional.
    hborders := ole2.get_obj_property (htable, 'Borders');          
    ole2.set_property (hborders                                        
    ,'OutsideLineStyle'
    ,wdlinestylenone
    ole2.set_property (hborders
    ,'InsideLineStyle'
    ,wdlinestylenone
    ole2.RELEASE_OBJ (hborders);
    --[Borders removal end]
    --The following code makes the cursor enter the table. I took quite some time
    --figuring this out.
    hselection := ole2.get_obj_property (hdocument, 'Tables');
    hselection := ole2.get_obj_property (happlication, 'Selection');
    --WRITE_HEADINGS is the procedure called each time only to write headings.
    write_headings (hselection
    ,'Heading 1 on cell at row 1 column 1'
    ,8
    --The following moves the cursor to the next cell on the right.
    args := ole2.create_arglist;
    ole2.add_arg (args, wdcell);
    ole2.add_arg (args, 1);
    ole2.add_arg (args, wdmove);
    ole2.invoke (hselection
    ,'MoveRight'
    ,args
    ole2.destroy_arglist (args);
    write_headings (hselection
    ,'Heading 1 on cell at row 1 column 2'
    ,7
    args := ole2.create_arglist;
    ole2.add_arg (args, wdcell);
    ole2.add_arg (args, 1);
    ole2.add_arg (args, wdmove);
    ole2.invoke (hselection
    ,'MoveRight'
    ,args
    ole2.destroy_arglist (args);
    write_headings (hselection
    ,'Heading 1 on cell at row 1 column 3'
    ,7
    args := ole2.create_arglist;
    ole2.add_arg (args, wdcell);
    ole2.add_arg (args, 1);
    ole2.add_arg (args, wdmove);
    ole2.invoke (hselection
    ,'MoveRight'
    ,args
    ole2.destroy_arglist (args);
    write_headings (hselection
    ,'Heading 1 on cell at row 1 column 4'
    ,8
    args := ole2.create_arglist;
    ole2.add_arg (args, wdcell);
    ole2.add_arg (args, 1);
    ole2.add_arg (args, wdmove);
    ole2.invoke (hselection
    ,'MoveRight'
    ,args
    ole2.destroy_arglist (args);
    write_headings (hselection
    ,'Heading 1 on cell at row 1 column 5'
    ,5
    args := ole2.create_arglist;
    ole2.add_arg (args, wdcell);
    ole2.add_arg (args, 1);
    ole2.add_arg (args, wdmove);
    ole2.invoke (hselection
    ,'MoveRight'
    ,args
    ole2.destroy_arglist (args);
    write_headings (hselection
    ,'Heading 1 on cell at row 1 column 6'
    ,8
    --The following moves the cursor back to the first cell on row 1 column 1
    args := ole2.create_arglist;
    ole2.add_arg (args, wdcell);
    ole2.add_arg (args, 6);
    ole2.add_arg (args, wdmove);
    ole2.invoke (hselection
    ,'MoveLeft'
    ,args
    ole2.destroy_arglist (args);
    --Now we need to write data sourced from a multi record block in Oracle Forms
    GO_BLOCK ('your_block');
    FIRST_RECORD;
    record_cnt := 0;
    LOOP
    record_cnt := record_cnt + 1;
    ---In my application I gave the choice to the user to put a check mark on those records that he would want to print ------on the document and so the following.
    IF :your_block.cb_print = 'Y'          
    THEN               
    --This creates a new row below the first row that contains the column headers.
    args := ole2.create_arglist; ole2.add_arg (args, 1);
    ole2.invoke (hselection
    ,'InsertRowsBelow'
    ,args
    ole2.destroy_arglist (args);
    --WRITE_DATA is called each time to write the data in the cells.
    write_data (hselection
    , :your_block.item);
    args := ole2.create_arglist;
    ole2.add_arg (args, wdcell);
    ole2.add_arg (args, 1);
    ole2.add_arg (args, wdmove);
    ole2.invoke (hselection
    ,'MoveRight'
    ,args
    ole2.destroy_arglist (args);
    write_data (hselection
                   , :your_block.item);
    args := ole2.create_arglist;
    ole2.add_arg (args, wdcell);
    ole2.add_arg (args, 1);
    ole2.add_arg (args, wdmove);
    ole2.invoke (hselection
    ,'MoveRight'
    ,args
    ole2.destroy_arglist (args);
    write_data (hselection
                   ,:your_block.item);
    args := ole2.create_arglist;
    ole2.add_arg (args, wdcell);
    ole2.add_arg (args, 1);
    ole2.add_arg (args, wdmove);
    ole2.invoke (hselection
    ,'MoveRight'
    ,args
    ole2.destroy_arglist (args);
    write_data (hselection
         ,:your_block.item);
    args := ole2.create_arglist;
    ole2.add_arg (args, wdcell);
    ole2.add_arg (args, 1);
    ole2.add_arg (args, wdmove);
    ole2.invoke (hselection
    ,'MoveRight'
    ,args
    ole2.destroy_arglist (args);
    write_data (hselection
         ,:your_block.item);
    args := ole2.create_arglist;
    ole2.add_arg (args, wdcell);
    ole2.add_arg (args, 1);
    ole2.add_arg (args, wdmove);
    ole2.invoke (hselection
    ,'MoveRight'
    ,args
    ole2.destroy_arglist (args);
    write_data (hselection
    ,:your_block.item);
    END IF;
    EXIT WHEN :SYSTEM.LAST_RECORD = 'TRUE';
    NEXT_RECORD;
    END LOOP;
    --The following makes the cursor exit the table and back on document for any further
    --writing of text.
    args := ole2.create_arglist;
    ole2.add_arg (args, wdline);
    ole2.add_arg (args, 1);
    ole2.add_arg (args, wdmove);
    ole2.invoke (hselection
    ,'MoveDown'
    ,args
    print_line (hselection           --As mentioned earlier, this enters a blank line.
    ,NULL
    ,NULL
    print_line (hselection
    ,'Boilerplate text: '
    ,your_variable
    print_line (hselection
    ,'Boilerplate text: '
    ,your_variable
    --You can print as many lines as required by making call to the PRINT_LINE procedure.
    ole2.RELEASE_OBJ (htables);
    ole2.RELEASE_OBJ (hfont);
    ole2.RELEASE_OBJ (hselection);
    ole2.RELEASE_OBJ (hdocument);
    ole2.RELEASE_OBJ (hdocuments);
    ole2.RELEASE_OBJ (happlication);
    END;
    PROCEDURE PRINT_LINE
    ( v_sel OLE2.OBJ_TYPE
    , v_text VARCHAR2
    , v_field varchar2)
    IS
    /* This procedure takes in three arguments.
    The first v_sel is the VB selection object.
    v_text is the static or boilerplate text that needs to be printed on the document.
    v_field is the value of the item or variable from the program.
    v_args      OLE2.LIST_TYPE;
    hTab     CONSTANT varchar2(1) := chr(9); --This is the vb constant for tabstop
    BEGIN
    v_args := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(v_args, v_text);
    OLE2.INVOKE(v_sel, 'TypeText', v_args);
    OLE2.DESTROY_ARGLIST(v_args);
    --The following replicates tabbing. This was used so that the field values are aligned at a tabstop.
    --When printing a blank line NULL is passed in as the argument
    v_args := OLE2.CREATE_ARGLIST;
         OLE2.ADD_ARG(v_args, hTab);
         OLE2.INVOKE(v_sel, 'TypeText', v_args);
         OLE2.DESTROY_ARGLIST(v_args);
    --The following writes the value of the variable at the tabstop.      
         v_args := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(v_args, v_field);
    OLE2.INVOKE(v_sel, 'TypeText', v_args);
    OLE2.DESTROY_ARGLIST(v_args);
    OLE2.INVOKE(v_sel, 'TypeParagraph');
    END;
    PROCEDURE WRITE_HEADINGS (SELIN OLE2.OBJ_TYPE, TEXTIN VARCHAR2, COUNTIN NUMBER)
    IS
    /* This procedure is used to write headings in the first row of the table.
    SELIN is the Selection object
    TEXTIN is the boilerplate text to be written as the header of a column.
    COUNTIN is the number of characters in the header text. This is required
    to replicate the action bolding the font of the header.
    hFont          OLE2.OBJ_TYPE;
    v_args OLE2.LIST_TYPE;
    wdCharacter CONSTANT number(5) := 1; --Default
    --wdUnderline Class members
    wdUnderlineSingle                     CONSTANT NUMBER(5) := 1;
    ---- wdMovementType Class members
    wdExtend CONSTANT number(5) := 1;
    wdMove CONSTANT number(5) := 0; --Default
    ---- WdParagraphAlignment Class members
    wdAlignParagraphCenter CONSTANT number(5) := 1;
    wdAlignParagraphLeft CONSTANT number(5) := 0;
    wdAlignParagraphRight CONSTANT number(5) := 2;
    ---- HexColor = BBGGRR
    myLightBlue CONSTANT number(8) := 16755370; --FFAAAA
    BEGIN
    hFont := OLE2.GET_OBJ_PROPERTY(selin, 'Font');
    OLE2.SET_PROPERTY(hFont, 'Name', 'Calibri');
    OLE2.SET_PROPERTY(hFont, 'Size', 10);
    OLE2.SET_PROPERTY(hFont, 'Bold', True);
    OLE2.RELEASE_OBJ(hFont);
    v_args := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(v_args, textin);
    OLE2.INVOKE(selin, 'TypeText', v_args);
    OLE2.DESTROY_ARGLIST(v_args);
    v_args := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(v_args, wdCharacter);
    OLE2.ADD_ARG(v_args, countin);
    OLE2.ADD_ARG(v_args, wdMove);
    OLE2.INVOKE(selin, 'MoveLeft', v_args);
    OLE2.DESTROY_ARGLIST(v_args);
    v_args := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(v_args, wdCharacter); --Unit
    OLE2.ADD_ARG(v_args, countin); --Count
    OLE2.ADD_ARG(v_args, wdExtend); --Extend
    OLE2.INVOKE(selin, 'MoveRight', v_args);
    OLE2.DESTROY_ARGLIST(v_args);
    hFont := OLE2.GET_OBJ_PROPERTY(selin, 'Font');
    OLE2.SET_PROPERTY(hFont, 'Underline', wdUnderlineSingle);
    OLE2.RELEASE_OBJ(hFont);
    END;
    PROCEDURE WRITE_DATA (SELIN OLE2.OBJ_TYPE, TEXTIN VARCHAR2)
    IS
    /*This procedure writes data in the cells of the table
    hFont     OLE2.OBJ_TYPE;
    v_args OLE2.LIST_TYPE;
    wdCharacter CONSTANT number(5) := 1; --Default
    --wdUnderline Class members
    wdUnderlineSingle                     CONSTANT NUMBER(5) := 0;
    ---- wdMovementType Class members
    wdExtend CONSTANT number(5) := 1;
    wdMove CONSTANT number(5) := 0; --Default
    ---- WdParagraphAlignment Class members
    wdAlignParagraphCenter CONSTANT number(5) := 1;
    wdAlignParagraphLeft CONSTANT number(5) := 0;
    wdAlignParagraphRight CONSTANT number(5) := 2;
    ---- HexColor = BBGGRR
    myLightBlue CONSTANT number(8) := 16755370; --FFAAAA
    BEGIN
    hFont := OLE2.GET_OBJ_PROPERTY(selin, 'Font');
    OLE2.SET_PROPERTY(hFont, 'Name', 'Calibri');
    OLE2.SET_PROPERTY(hFont, 'Size', 10);
    OLE2.SET_PROPERTY(hFont, 'Bold', False);
    OLE2.SET_PROPERTY(hFont, 'Underline', wdUnderlineSingle);
    OLE2.RELEASE_OBJ(hFont);
    v_args := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(v_args, textin);
    OLE2.INVOKE(selin, 'TypeText', v_args);
    OLE2.DESTROY_ARGLIST(v_args);
    END;
    Edited by: smilingbandit on 31-Mar-2010 7:05 PM
    Edited by: smilingbandit on 31-Mar-2010 8:23 PM
    Edited by: smilingbandit on Apr 1, 2010 6:14 AM: Reason - Fixed formatting of comments.

  • How to use saveas webarchive in word using OLE2

    Hello,
    I am using the webutil word demo (without webutil) on the client. This demo is working fine.
    Now I like to save the file not as a word document, but as a WebArchive or html file. How can I pass the fileformat argument to the saveas invoke call. Or is there a other way to do this using ole2.
    Below the demo code.
    Thanks in advance,
    Fred.
    DECLARE
    app OLE2.OBJ_TYPE;
    docs OLE2.OBJ_TYPE;
    doc OLE2.OBJ_TYPE;
    selection OLE2.OBJ_TYPE;
    args OLE2.LIST_TYPE;
    BEGIN
    -- create a new document
    app := OLE2.CREATE_OBJ('Word.Application');
    OLE2.SET_PROPERTY (app,'Visible',1);
    docs := OLE2.GET_OBJ_PROPERTY(app, 'Documents');
    doc := OLE2.INVOKE_OBJ(docs, 'add');
    selection := OLE2.GET_OBJ_PROPERTY(app, 'Selection');
    -- insert data into new document from long item
    OLE2.SET_PROPERTY(selection, 'Text', 'this is a test message');
    -- save document as example.tmp
    args := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(args, 'c:\example.doc');
    OLE2.INVOKE(doc, 'SaveAs', args);
    OLE2.DESTROY_ARGLIST (args);
    -- close example.tmp
    args := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(args, 0);
    OLE2.INVOKE(doc, 'Close', args);
    OLE2.DESTROY_ARGLIST(args);
    OLE2.RELEASE_OBJ(selection);
    OLE2.RELEASE_OBJ(doc);
    OLE2.RELEASE_OBJ (docs);
    Using OLE Commands
    OLE2.INVOKE(app,'Quit');
    END;

    Hi Fred,
    Word's SaveAs() method takes file format as it's second argument. The following code snippet shows how to save as HTML:
      args := OLE2.CREATE_ARGLIST;
      OLE2.ADD_ARG(args, 'c:\example.html');
      OLE2.ADD_ARG(args, 8);
      OLE2.INVOKE(doc, 'SaveAs', args);Eric Adamson
    Lansing, Michigan

  • Internet Explorer OLE2 problems

    I am trying to control Internet Explorer 6 using OLE2 from forms to open and print an html document. I can open the html document, but I cannot print. Here is the code:
    declare
    webhandle ole2.obj_type;
    args OLE2.LIST_TYPE;
    begin
    webhandle := OLE2.CREATE_OBJ('InternetExplorer.APPLICATION');
    --Open
    OLE2.set_property(webhandle,'Visible','True');
    args := OLE2.create_arglist;
    OLE2.add_arg(args,'c:\test.htm');
    OLE2.invoke(webhandle,'Navigate',args);
    OLE2.destroy_arglist(args);
    --Print
    OLE2.INVOKE(webhandle,'FilePrint');
    OLE2.release_obj(webhandle);
    end;
    Does anyone know how to print from IE6 using OLE2? Also, does anyone know how to select which printer to print to as well?

    Hi Kirk,
    I think Robin is right. Take a look at MSDN (msdn.microsoft.com). It says that you should use ExecWB method to do that.
    For example:
    webhandle := OLE2.CREATE_OBJ('InternetExplorer.APPLICATION');
    OLE2.set_property(webhandle,'Visible','True');
    -- Open the MSDN :)
    args := OLE2.create_arglist;
    OLE2.add_arg(args,
    'http://msdn.microsoft.com/library' ||
    '/default.asp?url=/workshop/browser/' ||
    'webbrowser/reference/methods/execwb.asp' );
    OLE2.invoke(webhandle,'Navigate',args);
    OLE2.destroy_arglist(args);
    -- Wait while document isn't loaded
    WHILE OLE2.GET_NUM_PROPERTY( webhandle,'Busy' ) <> 0 LOOP
    Message( 'Document hasn''t been loaded yet.' );
    END LOOP;
    Message( 'Document is loaded!' );
    Message( ' ', NO_ACKNOWLEDGE );
    -- Print preview.
    -- Of course, you could use OLECMDID_PRINT = 6 for
    -- printing instead of calling printpreview window.
    args := OLE2.create_arglist;
    OLE2.add_arg(args, 7 ); -- OLECMDID_PRINTPREVIEW
    OLE2.add_arg(args, 0 ); -- OLECMDEXECOPT_DODEFAULT
    OLE2.INVOKE(webhandle,'ExecWB', args);
    OLE2.destroy_arglist(args);
    OLE2.release_obj(webhandle);
    P.S. If you need number values of constants such as OLECMDID_PRINT, let me know your e-mail. I'll send it to you. My e-mail is [email protected]

  • How can I select the existing worksheet while using OLE2 to open the template workboo

    Source:
    application:=ole2.create_obj('Excel.Application');
    workbooks:=ole2.get_obj_property(application,'Workbooks');
    args := ole2.create_arglist;
    ole2.add_arg(args, 'c:\RptTemplate.xlt');
    workbook:=ole2.invoke_obj(workbooks,'Open',args);
    ole2.destroy_arglist(args);
    worksheets:=ole2.get_obj_property(application,'Worksheets');
    args := ole2.create_arglist;
    ole2.add_arg(args, 'Sheet1');      
    worksheet     :=ole2.invoke_obj(worksheets,'Select',args);
    ole2.destroy_arglist(args);
    Problem:
    1. While executing the above code, error -305500 occurs after executing "worksheet := ole2.invoke_obj(worksheets','Select',args)". How can I select the sheet i wanted in the template ??
    2. As I refer to the forms on-line document, it stated that the ole2 programmers documentation can provide all object types and methods that can be used with the OLE2. Does any link can provided to download the specified documentation ??

    The error is probably that your Worksheets variable is actually empty. Looking at your code I think the problem is that you try and get the value of the worksheets collection from the application then you should try and get it from the Workbooks object.

  • OLE2 error in Forms 6i.

    Hello All,
    I am using forms 6i and database 9i and Office 2007.
    When I am trying to import data from a excel file to the database using forms 6i OLE2 I am not getting the proper data. For example,
    I have excel data as below.
    EMPID ACC_NO PP_ID -- All are fields are declared as varahcr2 in the database. But in the excel other then empid all the fields are as number like below.
    EM001 1000121 10000101
    EM002 0213322 20100212
    When I am uploading the data, it is taking the EMPID as correct data but the other two fields are taking as first charector like
    EM001 1 1
    EM002 0 2
    Any suggestion on it.
    Thanks,
    SUN

    Hi,
    After converting to the text I am getting the error ORA-01403, No data found.
    And if I am not converting to the text I am not getting any error.
    My code is like below.
    <code>
    FUNCTION LF_EMP_ACC_UPDATE(P_PATH_FILE VARCHAR2) RETURN BOOLEAN IS
    /* EXCEL -> FORMS */
         APPLICATION OLE2.OBJ_TYPE;
         WORKBOOKS          OLE2.OBJ_TYPE;
         WORKBOOK          OLE2.OBJ_TYPE;     
         WORKSHEETS     OLE2.OBJ_TYPE;     
         WORKSHEET          OLE2.OBJ_TYPE;     
         CELL                    OLE2.OBJ_TYPE;     
         ARGS                    OLE2.LIST_TYPE;     
         LN_CNT               NUMBER(10) := 0;
         LN_ROW               NUMBER(5) := 0;
    LN_COL               NUMBER(5) := 0;     
    LN_QTY               NUMBER(20,3) := 0;          
    LV_STATUS          VARCHAR2(500);
    err_code           BINARY_INTEGER;
    err_text           VARCHAR2(255);
         LV_EMPID VARCHAR2(20);
    LV_PAYROLL_ID VARCHAR2(20);
    LV_VHM_EMP_CODE VHM_EMPLOYEE.VHM_EMP_CODE%TYPE;
    LV_VHM_EMP_NOK_PHONE VHM_EMPLOYEE.VHM_EMP_NOK_PHONE%TYPE;
    LV_VHM_EMP_PAY_MODE VHM_EMPLOYEE.VHM_EMP_PAY_MODE%TYPE;
    LV_VHM_EMP_BANK_CODE VHM_EMPLOYEE.VHM_EMP_BANK_CODE%TYPE;
    LV_VHM_EMP_BANK_AC_NO VHM_EMPLOYEE.VHM_EMP_BANK_AC_NO%TYPE;
    PROD_CODE_CHK VARCHAR2(40);
    NUM NUMBER:=0;
    BEGIN
    APPLICATION := OLE2.CREATE_OBJ('EXCEL.APPLICATION');
    WORKBOOKS := OLE2.GET_OBJ_PROPERTY(APPLICATION,'WORKBOOKS');
    ARGS := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(ARGS,P_PATH_FILE);
    WORKBOOK := OLE2.INVOKE_OBJ(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);
    -- This procedure is run last 16-aug-2007 fro updation ROL And ROQ     
    DISPLAY_ME('DO YOU WANT TO UPDATE EMPLOYEE MASTER OLD');
    LN_ROW := 1;
    LOOP
                   -- To reset Variable
         LV_EMPID                :=NULL;
    LV_PAYROLL_ID :=NULL;
    LV_VHM_EMP_CODE      :=NULL;
    LV_VHM_EMP_NOK_PHONE      :=NULL;
    LV_VHM_EMP_PAY_MODE      :=NULL;
    LV_VHM_EMP_BANK_CODE      :=NULL;
    LV_VHM_EMP_BANK_AC_NO      :=NULL;
         LN_ROW := LN_ROW+1;
         LN_COL := 1;
         ARGS := OLE2.CREATE_ARGLIST;
         OLE2.ADD_ARG(ARGS,LN_ROW);
         OLE2.ADD_ARG(ARGS,LN_COL);
         CELL := OLE2.GET_OBJ_PROPERTY(WORKSHEET,'CELLS',ARGS);
         OLE2.DESTROY_ARGLIST(ARGS);
         LV_VHM_EMP_CODE := OLE2.GET_CHAR_PROPERTY(CELL,'VALUE');
         OLE2.RELEASE_OBJ(CELL);
         --EXIT WHEN LV_VHM_EMP_CODE IS NULL;
         EXIT WHEN LN_ROW >= 555;
         LN_COL := 2;
         ARGS := OLE2.CREATE_ARGLIST;
         OLE2.ADD_ARG(ARGS,LN_ROW);
         OLE2.ADD_ARG(ARGS,LN_COL);
         CELL := OLE2.GET_OBJ_PROPERTY(WORKSHEET,'CELLS',ARGS);
         OLE2.DESTROY_ARGLIST(ARGS);
         LV_VHM_EMP_NOK_PHONE := OLE2.GET_CHAR_PROPERTY(CELL,'VALUE');
         OLE2.RELEASE_OBJ(CELL);
         LN_COL := 3;
         ARGS := OLE2.CREATE_ARGLIST;
         OLE2.ADD_ARG(ARGS,LN_ROW);
         OLE2.ADD_ARG(ARGS,LN_COL);
         CELL := OLE2.GET_OBJ_PROPERTY(WORKSHEET,'CELLS',ARGS);
         OLE2.DESTROY_ARGLIST(ARGS);
         LV_VHM_EMP_PAY_MODE := OLE2.GET_CHAR_PROPERTY(CELL,'VALUE');
         OLE2.RELEASE_OBJ(CELL);
         LN_COL := 4;
         ARGS := OLE2.CREATE_ARGLIST;
         OLE2.ADD_ARG(ARGS,LN_ROW);
         OLE2.ADD_ARG(ARGS,LN_COL);
         CELL := OLE2.GET_OBJ_PROPERTY(WORKSHEET,'CELLS',ARGS);
         OLE2.DESTROY_ARGLIST(ARGS);
         LV_VHM_EMP_BANK_CODE := OLE2.GET_CHAR_PROPERTY(CELL,'VALUE');
         OLE2.RELEASE_OBJ(CELL);
         LN_COL := 5;
         ARGS := OLE2.CREATE_ARGLIST;
         OLE2.ADD_ARG(ARGS,LN_ROW);
         OLE2.ADD_ARG(ARGS,LN_COL);
         CELL := OLE2.GET_OBJ_PROPERTY(WORKSHEET,'CELLS',ARGS);
         OLE2.DESTROY_ARGLIST(ARGS);
         LV_VHM_EMP_BANK_AC_NO := OLE2.GET_CHAR_PROPERTY(CELL,'VALUE');
         OLE2.RELEASE_OBJ(CELL);                    
    :F_DISP := 'EMPLOYEE ID - '||LV_VHM_EMP_CODE;
         SYNCHRONIZE;
         IF LV_VHM_EMP_CODE IS NOT NULL THEN
              IF LN_ROW >= 1 AND LN_ROW <= 5 THEN
         MESSAGE('EMP CODE :- '||LV_VHM_EMP_CODE);
         MESSAGE('EMP EMPLOYEE ID :- '||LV_VHM_EMP_NOK_PHONE);
         MESSAGE('EMP PAY MODE :- '||LV_VHM_EMP_PAY_MODE);
         MESSAGE('EMP BANK CODE :- '||LV_VHM_EMP_BANK_CODE);
         MESSAGE('EMP ACCOUNT NO :- '||LV_VHM_EMP_BANK_AC_NO);
              END IF;
    UPDATE VHM_EMPLOYEE_OLD SET
    VHM_EMP_NOK_PHONE     = LV_VHM_EMP_NOK_PHONE,
    VHM_EMP_PAY_MODE = LV_VHM_EMP_PAY_MODE,
    VHM_EMP_BANK_CODE = LV_VHM_EMP_BANK_CODE,
    VHM_EMP_BANK_AC_NO = LV_VHM_EMP_BANK_AC_NO,
    VHM_EMP_EMAIL_ID = 'UPD'
              WHERE VHM_EMP_CODE = LV_VHM_EMP_CODE ;
              insert into vhm_emp_test (VHM_EMP_CODE,
    VHM_EMP_NOK_PHONE,
    VHM_EMP_PAY_MODE ,
    VHM_EMP_BANK_CODE ,
    VHM_EMP_BANK_AC_NO ,
    VHM_EMP_EMAIL_ID ) values ( LV_VHM_EMP_CODE, LV_VHM_EMP_NOK_PHONE,
    LV_VHM_EMP_PAY_MODE, LV_VHM_EMP_BANK_CODE,
    LV_VHM_EMP_BANK_AC_NO, null);
         END IF;
    COMMIT;     
    END LOOP;
         OLE2.INVOKE(APPLICATION,'QUIT');
    OLE2.RELEASE_OBJ(WORKSHEET);
    OLE2.RELEASE_OBJ(WORKBOOK);
    OLE2.RELEASE_OBJ(WORKBOOKS);          
    OLE2.RELEASE_OBJ(APPLICATION);
    IF FORM_SUCCESS THEN
         LV_STATUS := 'Update Completed';
    END IF;
         RETURN TRUE;
    EXCEPTION      
    WHEN OLE2.OLE_ERROR THEN
    ROLLBACK;
         err_code := olepack.get_err(err_text);
         DISPLAY_ME('Invalid File Eror Code:' || err_code || ': ' || err_text||', Program Aborted');
    --     P_STATUS := 'Invalid File Eror Code:' || err_code || ': ' || err_text||', Program Aborted';
              OLE2.INVOKE(APPLICATION,'QUIT');
              OLE2.RELEASE_OBJ(WORKSHEET);
              OLE2.RELEASE_OBJ(WORKBOOK);
              OLE2.RELEASE_OBJ(WORKBOOKS);          
              OLE2.RELEASE_OBJ(APPLICATION);     
         RETURN FALSE;
         WHEN OTHERS THEN
         ROLLBACK;
         DISPLAY_ME('When other errors- '||DBMS_ERROR_CODE || ': ' || DBMS_ERROR_TEXT);
              OLE2.INVOKE(APPLICATION,'QUIT');
              OLE2.RELEASE_OBJ(WORKSHEET);
              OLE2.RELEASE_OBJ(WORKBOOK);
              OLE2.RELEASE_OBJ(WORKBOOKS);          
              OLE2.RELEASE_OBJ(APPLICATION);     
    --     P_STATUS := 'Program Aborted,Exception : '||SQLERRM;
              RETURN FALSE;
    END LF_EMP_ACC_UPDATE;
    </code>
    Any suggestion on it.
    Thanks,
    SUN

  • Forms6i with OLE2 Integration on web client-Is possible? how?

    Hi Dears,
    When running a form on the Web, can I use OLE to talk to programs such as MS Word or Excel?
    This is my Q.
    In the Oracle FAQ the given solution like this:
    Yes. OLE integration works for external OLE servers invoked using OLE2.CREATE_OBJ. The OLE server you are invoking must be available on the middle tier machine where the Forms Services resides. Consequently the middle tier machine must be a Windows NT or Windows 2000 machine. Embedded OLE containers and ActiveX (OCX) controls are not supported when running on the Web.
    But the problem is,
    The applications(Excel,Word & etc.,) are opening in the middle tier, but not in the client mechine when i opening the word document.
    How can i open a MSWord in the client browser using orcle forms6i?!
    Please help me on this.
    Thanks & Regards,
    Vijayakumar.S

    Hi Shay,
    Thanks for your response.
    Shay, in Oracle FAQ one Q&A is like this
    Q:When running a form on the Web, can I use OLE to talk to programs such as MS Word or Excel?
    A:Yes. OLE integration works for external OLE servers invoked using OLE2.CREATE_OBJ. The OLE server you are invoking must be available on the middle tier machine where the Forms Services resides. Consequently the middle tier machine must be a Windows NT or Windows 2000 machine. Embedded OLE containers and ActiveX (OCX) controls are not supported when running on the Web.
    Are you sure, is not possible to open a Word Application in
    client mechine/browser?!
    Why i'm asking is, oracle answered it is possible.
    Please shay, i need your help, help me.
    Thanks & Regards,
    Vijayakumar.S

  • Add a ReplyTo or From in a mail using OLE2 in Forms 6

    Hi,
    I am doing a form to automatically send mails (I use forms because I do Excel docs using OLE to link them to the mails...). It works but the From and ReplyTo properties.
    My code is:
    FUNCTION Send_a_mail( Recp IN varchar2,
                                                 CopyTo IN varchar2,
                                                 CopyHidden IN varchar2,
                                                 MailFrom IN varchar2,
         Subject IN varchar2,
         Text IN varchar2,
         Attch IN varchar2,
         dialog IN number ) RETURN NUMBER
    IS
    objOutlook OLE2.OBJ_TYPE;
    objMail OLE2.OBJ_TYPE;
    objArg OLE2.LIST_TYPE;
    objAttach OLE2.OBJ_TYPE;
    BEGIN
         -- Connect to  Outlook
    objOutlook := OLE2.CREATE_OBJ('Outlook.Application');
         -- Create the Mail
         objarg := OLE2.CREATE_ARGLIST;
         OLE2.ADD_ARG(objarg,0);
         objMail := OLE2.INVOKE_OBJ(objOutlook,'CreateItem',objarg);
         OLE2.DESTROY_ARGLIST(objarg);
         IF Attch IS NOT NULL THEN
              -- Attach 1 file
              objAttach := OLE2.GET_OBJ_PROPERTY(objmail, 'Attachments');
              objarg := OLE2.CREATE_ARGLIST;
              OLE2.ADD_ARG(objarg, Attch ); -- filename
              OLE2.INVOKE(objattach, 'Add', objarg);
              OLE2.DESTROY_ARGLIST(objarg);
         END IF;
         -- Addresses
         IF MailFrom IS NOT NULL THEN
              OLE2.SET_PROPERTY(objmail,'From',MailFrom);
              OLE2.SET_PROPERTY(objmail,'ReplyTo',MailFrom);
         END IF;
         OLE2.SET_PROPERTY(objmail,'To',Recp);
         IF CopyTo IS NOT NULL THEN
              OLE2.SET_PROPERTY(objmail,'Cc',CopyTo);
         END IF;
         IF CopyHidden IS NOT NULL THEN
              OLE2.SET_PROPERTY(objmail,'Bcc',CopyHidden);
         END IF;
         OLE2.SET_PROPERTY(objmail,'Subject',Subject);
         OLE2.SET_PROPERTY(objmail,'HTMLBody',NVL(Text,' '));
         -- Send
         IF dialog = 1 THEN
              OLE2.INVOKE(objmail, 'Display');
         ELSE
              OLE2.INVOKE(objmail, 'Send');
         END IF;
         -- Free ressources
         OLE2.RELEASE_OBJ(objmail);
         OLE2.RELEASE_OBJ(objOutlook);
         return 0;
    END;
    Because I have no docs, I used Bcc, CC... and it works, so I thougth 'From' and 'ReplyTo' should work too, but it doesn't.
    Has any one a hint, or the true knowledge of this?
    Thanks a lot.
    Christian

    I think you're goining to have to find some documentation on the Outlook OLE interfaces. I've always found this kind of stuff on msdn.microsoft.com, although google os always up for it...

  • Urgent: CLIENT_OLE2.CREATE_OBJ('Excel.Application') get error

    My OS is Window server 2003, Office 2003, Oracle Form 10G
    I have installed Webutil successfully.
    Before using webutil I had tried this command: OLE2.Create_Obj('Excel.Application'). It had worked fine but when I using webutil. I replace above command with this command: Client_OLE2.Create_Obj('Excel.Application')I have gotten error.
    I don't know why. Could you help me, plz.
    Thank so much.

    More information, I see this exception in java console:
    Exception occurred during event dispatching:
    java.lang.ExceptionInInitializerError: java.security.AccessControlException: access denied (java.lang.RuntimePermission loadLibrary.jacob)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkLink(Unknown Source)
         at java.lang.Runtime.loadLibrary0(Unknown Source)
         at java.lang.System.loadLibrary(Unknown Source)
         at com.jacob.com.Dispatch.<clinit>(Dispatch.java)
         at oracle.forms.webutil.ole.OleFunctions.create_obj(OleFunctions.java:513)
         at oracle.forms.webutil.ole.OleFunctions.getProperty(OleFunctions.java:218)
         at oracle.forms.handler.UICommon.onGet(Unknown Source)
         at oracle.forms.engine.Runform.onGetHandler(Unknown Source)
         at oracle.forms.engine.Runform.processMessage(Unknown Source)
         at oracle.forms.engine.Runform.processSet(Unknown Source)
         at oracle.forms.engine.Runform.onMessageReal(Unknown Source)
         at oracle.forms.engine.Runform.onMessage(Unknown Source)
         at oracle.forms.engine.Runform.processEventEnd(Unknown Source)
         at oracle.ewt.lwAWT.LWComponent.redispatchEvent(Unknown Source)
         at oracle.ewt.lwAWT.LWComponent.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Window.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)

  • Ole2 error when reading excel from form 6i

    APPLICATION OLE2.OBJ_TYPE;
    WORKBOOKS OLE2.OBJ_TYPE;
    WORKBOOK OLE2.OBJ_TYPE;
    WORKSHEETS OLE2.OBJ_TYPE;
    WORKSHEET OLE2.OBJ_TYPE;
    CELL OLE2.OBJ_TYPE;
    SROW NUMBER:=0;
    COL NUMBER:=0;
    CELLVALUE VARCHAR2(89);
    V_RC_1 VARCHAR2(1000); -- TRANSACTION DATE
    V_RC_2 VARCHAR2(1000); -- STORE #
    V_RC_3 VARCHAR2(1000); -- INVOICE #
    V_RC_4 VARCHAR2(1000); -- CASES SOLD
    V_RC_5 VARCHAR2(1000);
    V_RC_6 VARCHAR2(1000);
    ARGS OLE2.OBJ_TYPE;
    BEGIN
         :STIME := TO_CHAR(SYSDATE, 'HH:MI:SS');
    SYNCHRONIZE;
         --------------INITIATE EXCEL APPLICATION---------------------------
    APPLICATION := OLE2.CREATE_OBJ('EXCEL.APPLICATION');
    OLE2.SET_PROPERTY(APPLICATION,'VISIBLE','TRUE');
    ----------------GET WORKBOOKS FROM EXCEL APPLICATION---------------
    WORKBOOKS := OLE2.GET_OBJ_PROPERTY(APPLICATION, 'WORKBOOKS');
    ----------------OPEN REQUIRED WORKBOOK-----------------------------
    ARGS := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(ARGS,:VFILE);
    WORKBOOK := OLE2.GET_OBJ_PROPERTY(WORKBOOKS,'OPEN',ARGS);
    OLE2.DESTROY_ARGLIST(ARGS);
    ----------------OPEN REQUIRED WORKSHEET---------------------------
    ARGS := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(ARGS,1);
    WORKSHEET := OLE2.GET_OBJ_PROPERTY(WORKBOOK,'WORKSHEETS',ARGS);
    OLE2.DESTROY_ARGLIST(ARGS);
    ----------------GET CELL VALUE-------------------------------------
    LOOP
         SROW := SROW+1;
    -----------------------COLUMN1-------------------------------------
    ARGS := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(ARGS,SROW);
    OLE2.ADD_ARG(ARGS,1);
    CELL := OLE2.GET_OBJ_PROPERTY(WORKSHEET,'CELLS',ARGS);
    OLE2.DESTROY_ARGLIST(ARGS);
    ARGS := OLE2.CREATE_ARGLIST;
    V_RC_1 := OLE2.GET_CHAR_PROPERTY(CELL,'TEXT');
    -----------------------COLUMN2-------------------------------------
    ARGS := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(ARGS,SROW);
    OLE2.ADD_ARG(ARGS,2);
    CELL := OLE2.GET_OBJ_PROPERTY(WORKSHEET,'CELLS',ARGS);
    OLE2.DESTROY_ARGLIST(ARGS);
    ARGS := OLE2.CREATE_ARGLIST;
    V_RC_2 := OLE2.GET_CHAR_PROPERTY(CELL,'TEXT');
    -----------------------COLUMN3-------------------------------------
    ARGS := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(ARGS,SROW);
    OLE2.ADD_ARG(ARGS,3);
    CELL := OLE2.GET_OBJ_PROPERTY(WORKSHEET,'CELLS',ARGS);
    OLE2.DESTROY_ARGLIST(ARGS);
    ARGS := OLE2.CREATE_ARGLIST;
    V_RC_3 := OLE2.GET_CHAR_PROPERTY(CELL,'TEXT');
    -----------------------COLUMN4-------------------------------------
    ARGS := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(ARGS,SROW);
    OLE2.ADD_ARG(ARGS,4);
    CELL := OLE2.GET_OBJ_PROPERTY(WORKSHEET,'CELLS',ARGS);
    OLE2.DESTROY_ARGLIST(ARGS);
    ARGS := OLE2.CREATE_ARGLIST;
    V_RC_4 := OLE2.GET_CHAR_PROPERTY(CELL,'TEXT');
    -----------------------COLUMN5-------------------------------------
    ARGS := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(ARGS,SROW);
    OLE2.ADD_ARG(ARGS,5);
    CELL := OLE2.GET_OBJ_PROPERTY(WORKSHEET,'CELLS',ARGS);
    OLE2.DESTROY_ARGLIST(ARGS);
    ARGS := OLE2.CREATE_ARGLIST;
    V_RC_5 := OLE2.GET_CHAR_PROPERTY(CELL,'TEXT');
    -----------------------COLUMN6-------------------------------------
    ARGS := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(ARGS,SROW);
    OLE2.ADD_ARG(ARGS,6);
    CELL := OLE2.GET_OBJ_PROPERTY(WORKSHEET,'CELLS',ARGS);
    OLE2.DESTROY_ARGLIST(ARGS);
    ARGS := OLE2.CREATE_ARGLIST;
    V_RC_6 := OLE2.GET_CHAR_PROPERTY(CELL,'TEXT');
    IF SROW >8 THEN
         EXIT;
    END IF;
    ---------------INSERT THE VALUE IN THE TABLE ---------------------
    INSERT INTO EMP VALUES(V_RC_1,V_RC_2,V_RC_3,V_RC_4,V_RC_5,V_RC_6);
    END LOOP;
    --END LOOP;
    COMMIT;
    ----------------CLOSE THE EXCEL SHEET AFTER READING--------------
    OLE2.INVOKE(APPLICATION,'QUIT');
    -----------------RELEASE ALL OBJECTS -----------------------------
    OLE2.RELEASE_OBJ(CELL);
    OLE2.RELEASE_OBJ(WORKSHEET);
    OLE2.RELEASE_OBJ(WORKBOOK);
    OLE2.RELEASE_OBJ(WORKBOOKS);
    OLE2.RELEASE_OBJ(APPLICATION);
    :MESSAGE := 'DATA INSERTED INTO THE TABLE '; SYNCHRONIZE;
    :ETIME := TO_CHAR(SYSDATE, 'HH:MI:SS');
    SYNCHRONIZE;
    END;

    Hi Kundi,
    by this time you might have solve your problem.
    If not, in your case,
    This could be you or user is closing the "Excel" application just appearing in front of there screen.
    To solve this replace the following line with the new line of code in your application:
    OLE2.SET_PROPERTY(APPLICATION,'VISIBLE','TRUE');
    with
    OLE2.SET_PROPERTY(APPLICATION,'VISIBLE','FALSE');
    Hope this will solve the problem.
    Regards,
    Tarun
    Edited by: Tarun.Oracle on Nov 9, 2012 12:44 PM
    Edited by: Tarun.Oracle on Nov 9, 2012 12:45 PM

  • How to invoke Internet Explorer and Adobe using OLE2

    Hi all
    We have to call IE and adobe using OLE2.
    how to do that ?
    Is it like how we do for word or excel. We tried that way but not working.
    e.g:
    app := OLE2.CREATE_OBJ('IExplore.Application');
    please help us.
    Thnx and regards
    Sriram

    The commands you pass are specific to the OLE service, so its not really a Forms question but a question for the OLE provider.
    Having said that - the questions I would ask is what are you trying to do? If you want to launch IE and display a PDF document you can do that with web.show_document. OLE will only work on the server and so the clients would not see IE if you were using OLE.
    REgards
    Grant Ronald
    Oracle Product Management

  • Forms to Excel (OLE2 and macro)

    Hi,
    I am using OLE2 to export data from Forms to Excel. Once I export the data into an excel spreadsheet successfully, I would like to format the worksheet. I have created a macro to do that and try to call the macro from Forms.
    I am getting Ora-305500 and Excel starts but the worksheet doesn't open.
    Is it something to do with the way I created/saved my macro?
    Please help!
    DECLARE
    application ole2.obj_type;
    workbooks ole2.obj_type;
    workbook ole2.obj_type;
    args ole2.list_type;
    BEGIN
    application:=ole2.create_obj('Excel.Application');
    ole2.set_property(application, 'Visible', 'True');
    args:=ole2.create_arglist;
    ole2.add_arg(args, 'C:\excel.xls');
    workbook:= ole2.invoke_obj(workbooks, 'Open',args);
    ole2.destroy_arglist(args);
    args:=ole2.create_arglist;
    ole2.add_arg(args, 'c:\personal.xls!acrt_macro');
    ole2.invoke(application, 'Run', args);
    ole2.destroy_arglist(args);
    --ole2.invoke(application,'Quit');
    ole2.release_obj(workbook);
    ole2.release_obj(workbooks);
    ole2.release_obj(application);
    END;

    Yes, it is possible to read from & write to an excel file.
    you have to use the DDE package to achieve your goal. Read the help content for DDE package, which explains in detail.

  • EXPORT DATA TO EXCEL BY OLE2 VARIANT ARRAY

    Hi all,
    I currently use 10g Forms. but every time have a error FRM-92101 occur when execute when-button-press trigger.
    anybody know what is the problem occur ?
    pls find below coding : -
    PROCEDURE EXP_EXCEL IS
    TYPE TStrs IS TABLE OF varchar2(1000) INDEX BY BINARY_INTEGER;
    MyApp ole2.obj_type;
    MyBook ole2.obj_type;
    MyWorkbooksCollection ole2.obj_type;
    myWorksheets ole2.obj_type;
    mySheet ole2.obj_type;
    args OLE2.LIST_TYPE;
    myRange ole2.obj_type;
    val varchar2(32000);
    startTime pls_integer;
    endTime pls_integer;
    -- Here is extra variable for this method
    strs TStrs;
    var OLEVAR;
    firstCell varchar2(100);
    lastCell varchar2(100);
    id pls_integer;
    BEGIN
    /* Open Excel and create new document */
    MyApp:=OLE2.Create_Obj('Excel.Application');
    OLE2.Set_Property( MyApp,'VISIBLE', 1 );
    MyWorkbooksCollection:=OLE2.GET_OBJ_PROPERTY( MyApp, 'Workbooks' );
    MyBook:=OLE2.Invoke_Obj( MyWorkbooksCollection,'Add' );
    myWorksheets:=OLE2.GET_OBJ_PROPERTY( MyBook,'Worksheets');
    /* Get the WorkSheet to work */
    args := OLE2.CREATE_ARGLIST; -- create argument list
    OLE2.ADD_ARG( args, 1 ); -- add worksheet INDEX
    MySheet := OLE2.GET_OBJ_PROPERTY( myWorksheets, 'Item', args);
    OLE2.DESTROY_ARGLIST( args);
    -- startTime:=WIN32.GetTickCount;
    /* Add the information */
    FOR myRowNum IN 1..8 LOOP
    strs.delete;
    -- Prepare the information for the row
    FOR myColumnNum IN 1..38 LOOP
    val:='t'||myRowNum||'_'||myColumnNum;
    strs(myColumnNum):=val;
    END LOOP;
    /* Get the address of the first and the last cells */
    args := OLE2.CREATE_ARGLIST; -- create argument list
    OLE2.ADD_ARG( args, myRowNum );
    OLE2.ADD_ARG( args, 1 );
    myRange:=OLE2.GET_OBJ_PROPERTY( mySheet, 'Cells', args );
    OLE2.DESTROY_ARGLIST( args);
    firstCell:=OLE2.GET_CHAR_PROPERTY( myRange, 'Address' );
    OLE2.RELEASE_OBJ( myRange );
    args := OLE2.CREATE_ARGLIST; -- create argument list
    OLE2.ADD_ARG( args, myRowNum );
    OLE2.ADD_ARG( args, 38 );
    myRange:=OLE2.GET_OBJ_PROPERTY( mySheet, 'Cells', args );
    OLE2.DESTROY_ARGLIST( args);
    lastCell:=OLE2.GET_CHAR_PROPERTY( myRange, 'Address' );
    OLE2.RELEASE_OBJ( myRange );
    /* Get the range */
    args := OLE2.CREATE_ARGLIST; -- create argument list
    OLE2.ADD_ARG( args, firstCell );
    OLE2.ADD_ARG( args, lastCell );
    myRange:=OLE2.GET_OBJ_PROPERTY( mySheet, 'Range', args );
    OLE2.DESTROY_ARGLIST( args);
    /* Set the cell value for range */
    var:=TO_VARIANT( strs );
    id:=GET_OLE_MEMBERID( myRange, 'Value' );
    SET_OLE( myRange, id, var );
    DESTROY_VARIANT( var );
    OLE2.RELEASE_OBJ( myRange );
    END LOOP;
    -- endTime:=WIN32.GetTickCount;
    -- :BLOCK1.FAST2_TIME:=TO_CHAR( (endTime-startTime) );
    OLE2.RELEASE_OBJ(mySheet);
    OLE2.RELEASE_OBJ(myWorksheets);
    OLE2.RELEASE_OBJ(MyBook);
    OLE2.RELEASE_OBJ(MyWorkbooksCollection);
    -- OLE2.INVOKE (MyApp,'Quit');
    OLE2.RELEASE_OBJ(MyApp);
    END;
    best regards
    boris

    For merging of cells you can refer following code!
    [Merging of cells.|https://www.sdn.sap.com/irj/scn/wiki?path=/display/community/oleconceptfordownloadingthereportoutputintoexcel]
    Regards,
    Lalit Mohan Gupta.

  • Will ole2.create_object work with Open Office Document?

    Dear All,
    Using ole2 package, we have already did a small application which will interact to Microsoft Excel. Now there is a business need to work with Sun's Open office document.
    We used to create a excel object like OLE2.CREATE_OBJ ('Excel.Application');
    Is there any other way of invoking/creating a open office spread sheet using ole2 package. Or any other way ?
    Regards,
    Balaji

    Dear Developer;
    Try this peace of code
    PROCEDURE exec_macro
    IS
    myapplication ole2.obj_type;
    mydocuments ole2.obj_type;
    mydocument ole2.obj_type;
    args ole2.list_type;
    Begin
    myapplication := ole2.create_obj ('Word.Application');
    ole2.set_property (myapplication, 'Visible', 0);
    mydocuments := ole2.get_obj_property (myapplication, 'Documents');
    args := ole2.create_arglist;
    ole2.add_arg (args, PC$FileName);
    mydocument := ole2.invoke_obj (mydocuments, 'Open', args);
    oe2.destroy_arglist (args);
    args := ole2.create_arglist;
    -- invoke the PrintPdf MSWorld macro
    ole2.add_arg (args, 'PrintPdf');
    ole2.invoke (myapplication, 'Run', args);
    ole2.destroy_arglist (args);
    ole2.invoke(myapplication,'Quit');
    ole2.Release_obj (mydocument);
    ole2.Release_obj (mydocuments);
    ole2.Release_obj (myapplication);
    End;
    Hope it works coz i did not try it but i try excel.application.
    Regards
    Reda El Mitwally

  • OLE2 error.

    hi all
    i want to import data from excel to form but it is showing me error frm-40735.please anyone can check my code?
    i have 18 rows
    and 14 cols
    its in tabular form.
    here is the code please check it where is the error?
    PROCEDURE XLS IS
    BEGIN
    DECLARE
    application OLE2.OBJ_TYPE;
    workbooks OLE2.OBJ_TYPE;
    workbook OLE2.OBJ_TYPE;
    worksheets OLE2.OBJ_TYPE;
    worksheet OLE2.OBJ_TYPE;
    cell OLE2.OBJ_TYPE;
    args OLE2.OBJ_TYPE;
    ctr NUMBER(12);
    cols NUMBER(2);
    name_var1 VARCHAR2(2000);
    name_var2 VARCHAR2(2000);
    name_var3 VARCHAR2(2000);
    name_var4 VARCHAR2(2000);
    name_var5 varchar2(2000);
    name_var6 varchar2(2000);
    name_var7 varchar2(2000);
    name_var8 varchar2(2000);
    name_var9 varchar2(2000);
    name_var10 varchar2(2000);
    name_var11 varchar2(2000);
    name_var12 varchar2(2000);
    name_var13 varchar2(2000);
    name_var14 varchar2(2000);
    name_var15 varchar2(2000);
    name_var16 varchar2(2000);
    name_var17 varchar2(2000);
    name_var18 varchar2(2000);
    filename varchar2(100);
    PROCEDURE OLEARG IS
    args OLE2.OBJ_TYPE;
    BEGIN
    args := OLE2.CREATE_ARGLIST;
    ole2.add_arg(args,ctr); -- row value
    ole2.add_arg(args,cols); -- column value
    cell := ole2.GET_OBJ_PROPERTY(worksheet,'Cells',args); -- initializing cell
    ole2.destroy_arglist(args);
    END;
    BEGIN
         CLEAR_BLOCK(NO_VALIDATE);
    filename :='C:\TRAVEL EXECL FORMAT NEEDED.XLS';--GET_FILE_NAME('c:\', File_Filter=>'Excel Files (*.xls)|*.xls|'); -- to pick the file
    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,filename); --'c:\13s002.xls'); -- file path and name
    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);
    ctr := 2; --row number
    cols := 1; -- column number
    FIRST_RECORD;
    LOOP
    OLEARG;
    --get_char_property FOR VARCHAR
    --get_num_property FOR NUMBER
    name_var1 := ole2.get_char_property(cell,'Value'); --cell value of the argument
    cols := cols+1;
    OLEARG;
    name_var2 := ole2.get_char_property(cell,'Value'); --cell value of the argument
    cols := cols+1;
    OLEARG;
    name_var3 := ole2.get_char_property(cell,'Value'); --cell value of the argument
    cols := cols+1;
    OLEARG;
    name_var4 := ole2.get_char_property(cell,'Value'); --cell value of the argument
    cols := cols+1;
    OLEARG;
    name_var6 := ole2.get_char_property(cell,'Value'); --cell value of the argument
    cols := cols+1;
    OLEARG;
    name_var7 := ole2.get_char_property(cell,'Value'); --cell value of the argument
    cols := cols+1;
    OLEARG;
    name_var8 := ole2.get_char_property(cell,'Value'); --cell value of the argument
    cols := cols+1;
    OLEARG;
    name_var9 := ole2.get_char_property(cell,'Value'); --cell value of the argument
    cols := cols+1;
    OLEARG;
    name_var10 := ole2.get_char_property(cell,'Value'); --cell value of the argument
    cols := cols+1;
    OLEARG;
    name_var12 := ole2.get_char_property(cell,'Value'); --cell value of the argument
    cols := cols+1;
    OLEARG;
    name_var13 := ole2.get_char_property(cell,'Value'); --cell value of the argument
    cols := cols+1;
    OLEARG;
    name_var14 := ole2.get_char_property(cell,'Value'); --cell value of the argument
    cols := cols+1;
    OLEARG;
    name_var16 := ole2.get_char_property(cell,'Value'); --cell value of the argument
    cols := cols+1;
    OLEARG;
    name_var17 := ole2.get_char_property(cell,'Value'); --cell value of the argument
    cols := cols+1;
    OLEARG;
    name_var18 := ole2.get_char_property(cell,'Value'); --cell number value of the argument
    EXIT WHEN name_var1 is null;--length(name_var1) = 0 or length(name_var1) is null;
    IF ctr = 1 then
    :policy_year:=name_var1;
    :policy_no:=name_var2;
    :Customer_name:=name_var3;
    :passport_no:=name_var4;
    :date_of_birth:=name_var5;
    :age:=name_var6;
    :address:=name_var7;
    :mobile_no:=name_var8;
    :issue_date:=name_var9;
    :branch:=name_var10;
    :agent_code:=name_var11;
    :gross_premium :=name_var12;
    :valid_from_date :=name_var13;
    :valid_to_date :=name_var14;
    :period :=name_var15;
    :travel_origin:=name_var16; 
    :pay_status :=name_var17;
    :area :=name_var18;   
    NULL;
    ELSE
    :policy_year:=name_var1;
    :policy_no:=name_var2;
    :Customer_name:=name_var3;
    :passport_no:=name_var4;
    :date_of_birth:=name_var5;
    :age:=name_var6;
    :address:=name_var7;
    :mobile_no:=name_var8;
    :issue_date:=name_var9;
    :branch:=name_var10;
    :agent_code:=name_var11;
    :gross_premium :=name_var12;
    :valid_from_date :=name_var13;
    :valid_to_date :=name_var14;
    :period :=name_var15;
    :travel_origin:=name_var16; 
    :pay_status :=name_var17;
    :area :=name_var18;   
    NEXT_RECORD;
    END IF;
    SYNCHRONIZE;
    ctr := ctr + 1;
    cols := 1;
    END LOOP;
    DELETE_RECORD;
    FIRST_RECORD;
    OLE2.INVOKE(application,'Quit');
    OLE2.RELEASE_OBJ(cell);
    OLE2.RELEASE_OBJ(worksheet);
    --OLE2.RELEASE_OBJ(worksheets);
    OLE2.RELEASE_OBJ(workbook);
    --OLE2.RELEASE_OBJ(workbooks);
    OLE2.RELEASE_OBJ(application);
    END;
    END;prompt answer will be greatly appreciated
    thanks in advance.
    sarah

    HI
    JOHN.
    where should i make changes in excel or in form code?
    can u guide me more?
    i tried the code something like this but did not give me correct result.
    here is the code.
    PROCEDURE sarah IS
         application OLE2.OBJ_TYPE;
         workbooks OLE2.OBJ_TYPE;
         workbook OLE2.OBJ_TYPE;
         worksheets OLE2.OBJ_TYPE;
         worksheet OLE2.OBJ_TYPE;
         cell OLE2.OBJ_TYPE;
         cellType OLE2.OBJ_TYPE;
         args OLE2.OBJ_TYPE;
         ctr number := 1;
         cols number := 1;
      maxColumns number := 18;
         MyString VARCHAR2(2000) := 'null';
         MyNumber NUMBER;
         cell_value_date DATE;
         filename varchar2(2000);
         BEGIN
                   go_block('hus');
                   CLEAR_BLOCK(NO_VALIDATE);
                   first_record;
                   go_item('policy_year');
                   filename :='C:\CHECK11.XLS';--GET_FILE_NAME('c:\', File_Filter=>'Excel Files (*.xls)|*.xls|'); -- to pick the file
                   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,filename); --'c:\13s002.xls'); -- file path and name
                   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);
         While (MyString is not null)
         loop
             args := OLE2.CREATE_ARGLIST;
                   ole2.add_arg(args,ctr); -- row value
                   ole2.add_arg(args,cols); -- column value
                   cell := ole2.GET_OBJ_PROPERTY(worksheet,'Cells',args); -- initializing cell
                   ole2.destroy_arglist(args);
                   if cols in(1,4,6,8,10,11,12,15,17,18, /*for dates*/ 5, 9, 13, 14) then
                        MyString := ole2.get_num_property(cell,'Value'); --cell value of the argument                                    
                   else
                        --MyString := ole2.get_char_property(cell,'Value'); --cell value of the argument
                        cell_value_date := to_date('01/01/1900', 'DD/MM/YYYY') + ole2.get_num_property(cell, 'Value') - 2;
                   end if;
                   --check the value of date format
            /*if cols in(5, 9, 13, 14) then
                  copy(to_char(to_date(Mystring,'DDMMRRRR'),'DD-MON-RRRR'), :system.cursor_item);
            else */
                   copy(MyString, :system.cursor_item);
           -- end if;
              cols := cols + 1;
              next_item;
              if cols >= maxColumns then
                    ctr := ctr + 1;
                    cols := 1;
                    next_record;
                    go_item('policy_year');
              end if;
         end loop;
    --          DELETE_RECORD;
              FIRST_RECORD;
              OLE2.INVOKE(application,'Quit');
              OLE2.RELEASE_OBJ(cell);
              OLE2.RELEASE_OBJ(worksheet);
              OLE2.RELEASE_OBJ(workbook);
              OLE2.RELEASE_OBJ(application); 
         exception when others then
               message(sqlerrm);
    END;sarah
    sarah

Maybe you are looking for