Board index » delphi » Excel 2000 and Delphi 5 - Where to start for an OLE newbie?

Excel 2000 and Delphi 5 - Where to start for an OLE newbie?

Hi.  I want to save a simple report to an excel spreadsheet.  We use Delphi
5 Enterprise and have the server tabs available.  There are components for
an application, a workbook and a worksheet.

I have viewed many examples of interacting with Excel and have become quite
confused.  The example form Mastering Delphi 5.0 uses an Excel application
component.  It does not work correctly, it leaves multiple threads open to
Excel each time I run the program.  Some forgo the components all together
and use oleobjects.   I realize there are probably dozens of techniques to
do this, but is there a single preferable way to do this?  I don't know when
or how to use the excel components and when I should use straight ole. Is
there a simple sample project (one that shows all the
connection/disconnection/creation code required to sever ties to Excel) I
can link to for guidance?

Thanks!
Debbie Erickson
debia...@earthlink.net

 

Re:Excel 2000 and Delphi 5 - Where to start for an OLE newbie?


<<Debbie Erickson:
I don't know when or how to use the excel components and
when I should use straight ole.

Quote

Have a look at my automation site, it answers most of your
questions and there is a sample project:
http://www.djpate.freeserve.co.uk/Automation.htm

The problem with Excel{*word*154} around in memory is quite
easily curable - you have to make sure there are no
oustanding references to Excel objects in your code. You
have to Disconnect every Excel component, not just the Ecel
application component. If you use variables the same
applies, and you have to set them to nil (or use VarClear
for variants).

--
Deborah Pate (TeamB) http://delphi-jedi.org

  Use Borland servers; TeamB don't see posts via ISPs
  http://www.borland.com/newsgroups/genl_faqs.html

Re:Excel 2000 and Delphi 5 - Where to start for an OLE newbie?


Thanks, Deborah!  This example helped a lot.  Still an unanswered question,
though, about calling the saveas method in excel (see new posting).

Other Threads