?
Solved

Excel Ole Automation - early binding

Posted on 1997-11-28
7
Medium Priority
?
510 Views
Last Modified: 2010-04-04
I am currently using late binding to automate Excel from Delphi 3. This is understandbly slow. Could anyone explain to me how to use the early binding approach and the importing of typelibs in this process?
0
Comment
Question by:kherbst
  • 3
  • 3
7 Comments
 
LVL 8

Expert Comment

by:ZifNab
ID: 1352337
Have you already looked at the TExcel component for your purposes?
0
 

Author Comment

by:kherbst
ID: 1352338
Yes, but it uses DDE and I don't want that.
0
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1352339
Hi

The following example has an OLE Container on a form (oleExcel) and I use that to get the IWorkSheet interface (which is declared in the Excel type library).

procedure TForm1.Button1Click(Sender: TObject);
var
    WS: IWorkSheets;
begin
    oleExcel.AutoActivate := aaManual;
    oleExcel.CreateObject('Excel.Sheet', False);
    oleExcel.DoVerb(ovShow);
    WS := IWorkSheets(oleExcel.OleObjectInterface);
    WS.PrintPreview(False, 0);
end;

To import the type library, choose "Import Type Library" from the Project menu and find the file called "Excel8.olb" in your MSOffice\Office path.  (I am using Delphi 3 with Office 97.)

Regards,
JB
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:kherbst
ID: 1352340
Do I have to use a Ole container in the process or can I use CreateOleObject?
0
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1352341
You can use create ole object or CoCreateInstance, whichever suits your purpose.
0
 

Author Comment

by:kherbst
ID: 1352342
Thank you, I accept your answer.
0
 
LVL 5

Accepted Solution

by:
JimBob091197 earned 400 total points
ID: 1352343
I guess this is the answer then...   :)

JB
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses

809 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