Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TExcelApplication

72 views
Skip to first unread message

Raymond Chow

unread,
Jan 18, 2001, 9:52:18 AM1/18/01
to
Hi folks,

I am using the TExcelApplication component to send data into an Excel
workbook. Using the early binding (VTable) interface, I dropped the
TExcelApplication object onto my form and can get an instance of Excel just
by calling a method. For example,

TForm1 = class(TForm)
...
MyExcelApp: TExcelApplication;
...
private
public
end;

procedure TForm1.Button1Click(Sender: TObject);
var
NumOfWorkbooks:Integer;
begin
NumOfWorkbooks:= MyExcelApp.Workbooks.Count;
with MyExcelApp do
begin
...
end;
end;

. Anybody, any though?
Raymond Chow
myExcelApp:= ExcelApplication.Workbooks.Count;

I can use myExcelApp and the Excel object model to do the automation. My
question is that when my program is done, do I need to release myExcelApp?
Currently my program just quit without releasing myExcelApp. My hope is
that TExcelApplication is just like any other object (e.g. TForm) that
Delphi will destroy when my program quits. However, I am worry that my
program may leak memory by not taking care of MyExcelApps!

Also, what is the purpose of lcid?

Raymond Chow


Deborah Pate (TeamB)

unread,
Jan 18, 2001, 10:10:44 AM1/18/01
to
<<Raymond Chow:

when my program is done, do I need to release myExcelApp?
>>

Yes, you do. If you don't want Excel to continue running,
you need to call its Quit method; and you also need to
Disconnect every Excel component you use, or Excel is
likely to keep running invisibly even after the Quit.

LCIDs are locale identifiers. Locale can be quite important
in Excel, since it affects number format (thousand
separators, etc) date format, currency signs, etc.

--
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


Raymond Chow

unread,
Jan 24, 2001, 9:03:53 AM1/24/01
to
Thanks Deborah. I put in the line myExcelApp.Disconnect and I feel safe
now.

As for the LCIDs, if my program is just for local use, can I just use zero
anytime a method requires a LCID?

Raymond Chow

"Deborah Pate (TeamB)" <d.p...@cableinet.co.not-this-bit.uk> wrote in
message news:VA.0000087...@cableinet.co.not-this-bit.uk...

Deborah Pate (TeamB)

unread,
Jan 24, 2001, 3:51:09 PM1/24/01
to
<<Raymond Chow:

if my program is just for local use, can I just use zero
anytime a method requires a LCID?
>>

Yes, it's usually fine.

0 new messages