Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Excel 8, OLE 2 automation, Delphi 2

Posted on 1997-04-02
2
Medium Priority
?
360 Views
Last Modified: 2010-04-06
I want to open, insert data, run macros and preview data loaded IN Excel 8 (FROM Delphi 2). Previously, this was done using DDE (Excel 5 and Delphi 1), but that causes low level OS errors that nobody (MS or Delphi support) can seem to find away around. I have read the "concept" of OLE from about 6 books that say how simple it is but can only give me the typical Word.basic example for OLE automation. But Excel seems to have a different set of methods (though, I was trying to use the same methods as I would if I were making the calls using VB). I am connecting via Excel.Application.8 but have also tried Excel.Worksheet.8 (the first is in the registry).

If anybody has an example of how to get to the Excel 8 predefined object and actually use it, that would be quite nice! OR if someone could just point me to where I could find out how to use the Excel object, that would be great.

Thanks,

Kelly
0
Comment
Question by:tinkerkel
2 Comments
 
LVL 1

Expert Comment

by:CFantin
ID: 1335093
I have an example on how to connect into Excel for Office 95
and it works great.
There should not be any differences between excel95 and excel97
but I am having problems connecting into excel97.
You may have the Excel95 example and try it with Excel97 to see
if it works.
0
 
LVL 7

Accepted Solution

by:
RBertora earned 300 total points
ID: 1335094
Hi there, here is what you need to get going.

uses OleAuto;

var
ExcelOb : Variant;

ExcelOB := CreateOleObject('Excel.Application');
ExcelOB.Visible := True;
ExcelOb.SheetsInNewWorkBook = 6;
ExcelOb.Workbooks.Add;
ExcelOb.ActiveWorkbook.Worksheets.Add;
ExcelOb.Caption := 'MyExcel';

ExcelOb.ActiveWorkBook.ActiveSheet.Range['A1'].Value :='MyValue';


And so on, you can use work all this out from the vb help
that is shipped with excel. There may be one or two syntax errors
in the above code... fiddle with it and you will get it to work.

Cheers,
Rob.



0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Integration Management Part 2
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question