DEV2000 & OLE Automation--Please Help

From: Michael T. Boduch <mboduch_at_interaccess.com>
Date: 1995/12/03
Message-ID: <mboduch.39.001BB4D5_at_interaccess.com>#1/1


What I'd like to do is this:

Use the OLE2 package delivered with Oracle Forms 4.5 to, in the background, create a new Excel 5.0 worksheet. Populate that worksheet with data from within the form (a multi-row block) and then save that worksheet to the file system. Later I could load it into an OLE container item within a form or just access it with Excel directly.

Oracle's demo form for OLE Automation only shows you how to access Excel built-in functions like, say, NPV. I've been playing around with this problem for a while now and I'm not getting anywhere fast. If anyone has experience with this I'd really love to see some of your code. Or if anyone from Oracle actually reads this group perhaps they could show me the way.

So far I've been able to create a worksheet object with:

obj ole2.obj_type := ole2.obj_create('excel.sheet.5');

and save it to the filesystem with:

ole2.invoke(obj,'SaveAs',pl);

where the parmlist variable (pl) is appropriately typed and a single parameter with the value "test.xls" is added to the list.

The only registed OLE classes on my PC that seem to apply are:

Excel.Application.5 and Excel.Sheet.5

Which makes me wonder: 1) Can I create both Application and Sheet level objects and have them both refer to the same thing? In other words, if I have both objects defined, will application-level methods invoked on the application object be in contact with the sheet-level object? So if I asked the Application-level object what the active workbook is, will it refer to the workbook that contains the sheet-level object that I created with my call to ole2.obj_create? See what I mean?

2) Am I even able to do what it is that I want to do? I started out with and assumption that I would have access to all of the classes, properties and methods (by using the OLE2 package) that are available to, say, Visual Basic. Now I'm not so sure. The tool "VBA Companion" shows me a TON of classes, properties, and methods available within Excel 5; now I need to know how to access this from PL/SQL (if it's even possible).

The last time I tried to send data from Forms to Excel was with the DDE support included in Forms 4.0.12. At the time I was trying to send data to Excel 4. I finally gave up on it. It was the most unstable piece of code I'd ever encountered and was excited to hear the Forms 4.5 would support OLE2. Now I've got the new software and I'm finding myself in familiar territory (i.e. little or no documentation from Oracle on what I'm trying to do, trial-and-error coding, General Protection Faults, etc.).

So, please, if *anyone* has blazed this trail before I'd be eternally grateful if you'd share your knowledge.

Thanks in advance for any assistance.

Mike Received on Sun Dec 03 1995 - 00:00:00 CET

Original text of this message