?
Solved

Excel Ole Automation - early binding

Posted on 1997-11-28
7
Medium Priority
?
501 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
[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
  • 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
Technology Partners: 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!

 

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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month9 days, 4 hours left to enroll

765 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