Solved

Excel 8, OLE 2 automation, Delphi 2

Posted on 1997-04-02
2
342 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 100 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

679 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