Solved

Excel 8, OLE 2 automation, Delphi 2

Posted on 1997-04-02
2
350 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month10 days, 11 hours left to enroll

628 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