Board index » delphi » Why Excel remains sometimes in memory?

Why Excel remains sometimes in memory?

Hi,

I have written an application which transfers dates from several big Excel
workbooks to Access. It works fine, when e.g. 4000 rows with 5 dates were
read. If I want to transfer more than 5000 rows, Excel remains in memory. If
the workbook is larger, the whole system will crash.
It seems to me as if the size of the workbook is responsible for this
problem. But the property 'MemoryFree' of the Excel application always shows
1MB.

I use D4 and Excel2K.

For the access to Excel I use early binding, but the problem occurs also by
late binding.
All methods necessary for it are in a seperate unit. The methods base on
"Deborah Pate's Pages - Automating Excel"
(http://www.djpate.freeserve.co.uk/Automation.htm).

Before quitting Excel all open workbooks were closed and the variables for a
worksheet and a workbook were set to nil.

Has anyone an idea?

Thanks,

Helmut

 

Re:Why Excel remains sometimes in memory?


<<Helmut Aust:
It works fine, when e.g. 4000 rows with 5 dates were
read. If I want to transfer more than 5000 rows, Excel
remains in memory. If the workbook is larger, the whole
system will crash.

Quote

Problems with large workbooks are reported quite regularly.
The best solution seems to be to reduce your access to a
minimum by writing to Excel in arrays, rather than one cell
or row at a time - would that be possible for your app?

--
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:Why Excel remains sometimes in memory?


Note: In my aplication,  Excel also waste at about 5 min. to calculate 13
Worksheets(wich one with 5000 Formulas)

And it's do not crashs.Is it Normal this long time to calculate????

Re:Why Excel remains sometimes in memory?


Deborah,

How can I write an array to Excel?

Also Deborah, you used to have a site where you explained at lot on OLE
Automation. Would you mind sending me the url?

Kind regards,
Roan van Riet

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

Quote
> <<Helmut Aust:
> It works fine, when e.g. 4000 rows with 5 dates were
> read. If I want to transfer more than 5000 rows, Excel
> remains in memory. If the workbook is larger, the whole
> system will crash.

> Problems with large workbooks are reported quite regularly.
> The best solution seems to be to reduce your access to a
> minimum by writing to Excel in arrays, rather than one cell
> or row at a time - would that be possible for your app?

> --
> 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:Why Excel remains sometimes in memory?


Deborah,

Do you have an example of how to write to Excel using arrays?

Also, you used to have a web site with a lot of OLE automation stuff. Would
you mind posting the url?

Kind regards,
Ronan van Riet

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

Quote
> <<Helmut Aust:
> It works fine, when e.g. 4000 rows with 5 dates were
> read. If I want to transfer more than 5000 rows, Excel
> remains in memory. If the workbook is larger, the whole
> system will crash.

> Problems with large workbooks are reported quite regularly.
> The best solution seems to be to reduce your access to a
> minimum by writing to Excel in arrays, rather than one cell
> or row at a time - would that be possible for your app?

> --
> 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:Why Excel remains sometimes in memory?


<<Ronan van Riet:
Do you have an example of how to write to Excel using
arrays?

Quote

 { Create a variant array with 4 rows (0 to 3)
   and 2 columns (0 to 1) }
  ArrV := VarArrayCreate([0, 3, 0, 1], varVariant);
  ArrV[0, 0] := 'First Column';
  ArrV[0, 1] := 'Second Column';
  ArrV[1, 0] := 'Second Row';
  ArrV[2, 0] := 'Third Row';
  ArrV[3, 0] := 'Fourth row';
  ArrV[3, 1] := 'Fourth row, second column';

  { Write the array to a worksheet }
  WS.Range['A1', 'B4'].Value := ArrV;

--
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:Why Excel remains sometimes in memory?


<<Ronan van Riet:
Would you mind posting the url?

Quote

Oops, I missed this bit.
http://www.djpate.freeserve.co.uk/Automation.htm

--
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:Why Excel remains sometimes in memory?


Did you ever find any examples of how to write to Excel using arrays?

I would also like an example.

"Ronan van Riet" <ro...@obiz.demon.nl> wrote in message
news:3bbd667a_1@dnews...

Quote
> Deborah,

> Do you have an example of how to write to Excel using arrays?

> Also, you used to have a web site with a lot of OLE automation stuff.
Would
> you mind posting the url?

> Kind regards,
> Ronan van Riet

> "Deborah Pate (TeamB)" <d.p...@cableinet.co.not-this-bit.uk> wrote in
> message news:VA.00000eb8.00328278@cableinet.co.not-this-bit.uk...
> > <<Helmut Aust:
> > It works fine, when e.g. 4000 rows with 5 dates were
> > read. If I want to transfer more than 5000 rows, Excel
> > remains in memory. If the workbook is larger, the whole
> > system will crash.

> > Problems with large workbooks are reported quite regularly.
> > The best solution seems to be to reduce your access to a
> > minimum by writing to Excel in arrays, rather than one cell
> > or row at a time - would that be possible for your app?

> > --
> > 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:Why Excel remains sometimes in memory?


<<Dwaine Horton:
Did you ever find any examples of how to write to Excel using
arrays?

Quote

I just posted one to this thread. Do you need any more?

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

Other Threads