Solved

Excel 8, OLE 2 automation, Delphi 2

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

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…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

777 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