Home » Developer & Programmer » Forms » Wat's wrong with this code..
Wat's wrong with this code.. [message #192914] Thu, 14 September 2006 03:46 Go to next message
sameer_am2002
Messages: 129
Registered: September 2002
Senior Member
Can anybody correct me in this code..
PROCEDURE PROC_OLE IS   -- DECLARE THE OLE OBJECTS
   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;
-- DECLARE HANDLES TO OLE ARGUMENT LISTS ARGS OLE2.LIST_TYPE;
BEGIN
-- START EXCEL AND MAKE IT VISIBLE
   APPLICATION  := OLE2.CREATE_OBJ ('EXCEL.APPLICATION');
   OLE2.SET_PROPERTY (APPLICATION, 'VISIBLE', 'TRUE');
-- RETURN OBJECT HANDLE TO THE WORKBOOKS COLLECTION
   WORKBOOKS    := OLE2.GET_OBJ_PROPERTY (APPLICATION, 'WORKBOOKS');
-- ADD A NEW WORKBOOK OBJECT TO THE WORKBOOKS COLLECTION
   WORKBOOK     := OLE2.INVOKE_OBJ (WORKBOOKS, 'ADD');
-- RETURN OBJECT HANDLE TO THE WORKSHEETS COLLECTION FOR THE WORKBOOK
   WORKSHEETS   := OLE2.GET_OBJ_PROPERTY (WORKBOOK, 'WORKSHEETS');
-- ADD A NEW WORKSHEET TO THE WORKSHEETS COLLECTION
   WORKSHEET    := OLE2.INVOKE_OBJ (WORKSHEETS, 'ADD');
-- RETURN OBJECT HANDLE TO CELL A1 ON THE NEW WORKSHEET
   ARGS         := OLE2.CREATE_ARGLIST;
   OLE2.ADD_ARG (ARGS, 1);
   OLE2.ADD_ARG (ARGS, 1);
   CELL         := OLE2.INVOKE_OBJ (WORKSHEET, 'CELL', ARGS);   --Giving error at this line...Non-Oracle Exception..
   OLE2.DESTROY_ARGLIST (ARGS);
-- SET THE CONTENTS OF THE CELL TO 'HELLO EXCEL!'
   OLE2.SET_PROPERTY (CELL, 'VALUE', 'HELLO EXCEL!');
--RELEASE THE OLE OBJECTS
   OLE2.RELEASE_OBJ (CELL);
   OLE2.RELEASE_OBJ (WORKSHEET);
   OLE2.RELEASE_OBJ (WORKSHEETS);
   OLE2.RELEASE_OBJ (WORKBOOK);
   OLE2.RELEASE_OBJ (WORKBOOKS);
   OLE2.RELEASE_OBJ (APPLICATION);
exception
   when no_data_found then
      MESSAGE ('successfully completed  ');
      pause;
      synchronize;
   --  commit;
   WHEN OTHERS THEN
      MESSAGE (SQLERRM || '~' || SQLCODE);
END;

Upd-mod: Please format your code and ALWAYS place it in 'code' tags.

[Updated on: Thu, 14 September 2006 23:02] by Moderator

Report message to a moderator

Re: Wat's wrong with this code.. [message #193010 is a reply to message #192914] Thu, 14 September 2006 09:38 Go to previous messageGo to next message
Liza79
Messages: 74
Registered: September 2006
Member
i need a little more detail, like what is the problem, what do you expect it to do, and how it is not fulfilling your expectations, is there any error, or its just not working?


Re: Wat's wrong with this code.. [message #320215 is a reply to message #192914] Wed, 14 May 2008 05:46 Go to previous message
jale
Messages: 15
Registered: May 2008
Location: TURKEY
Junior Member
TRY THIS

  CELL         := ole2.GET_OBJ_PROPERTY (WORKSHEET, 'CELL', ARGS); 
Previous Topic: when_list_changed
Next Topic: sort data in no DB block
Goto Forum:
  


Current Time: Wed Dec 07 03:17:15 CST 2016

Total time taken to generate the page: 0.16862 seconds