Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to reuse Excel instance or erase it from memory
Message
 
À
30/05/2009 19:18:37
Information générale
Forum:
Microsoft Office
Catégorie:
Excel
Divers
Thread ID:
01402808
Message ID:
01402956
Vues:
60
>I am developing a routine that creates excel workbooks using automation. Some of them are temporary but even though I close the book and try to quit excel I am accumulating instances of Excel which are using up memory doing nothing. How can I either close an unneded instance or reuse it?
>
>TIA,
>
>Alex

It depends. The cleanest way to close Excel is to close its childs first (if, say, you declare objects like oWorkBook or oWorkSheet, etc). Then you can close Excel releasing it and taking care of the variable:

oExcel.Quit
oExcel=null
release oExcel

If you close Excel, then in some cases you can reuse it:

if type("oExcel")="O" and not isnull(oExcel)
......

Also you can try:
on Error ll=.t.
ll=.f.
oExcel=GetObject(,"Excel.Application")
on error
if ll
oExcel=CreateObject("Excel.Application")
.....


Good Luck
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform