Solved

Excel Ole Automation - early binding

Posted on 1997-11-28
7
487 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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 200 total points
ID: 1352343
I guess this is the answer then...   :)

JB
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

708 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

17 Experts available now in Live!

Get 1:1 Help Now