Solved

Excel 8, OLE 2 automation, Delphi 2

Posted on 1997-04-02
2
319 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
Comment Utility
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
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

728 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now