Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Reliable way to release Excel?
Message
De
22/10/2003 08:43:47
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00840734
Message ID:
00840977
Vues:
28
Hello, David, and many thanks to all of you for your answers.


Look what I've found:

In the code I had a call to a standard messagebox ("The report was saved to (path)". When I removed the call, my problem was gone. I have absolutely no idea why.

If i put it back, the problem reappears. I moved all the code in a separate method, call it, then messagebox, then thisform.release. And now it works ok - the oExcel object is release quite instantaneous (the file wasn't big - about 30 rows in one single worksheet).

However, while I was digging the problem I found another problem and this is definately a bug in VFP8 SP1:

Create a prg. Let's name it "test.prg".

The contents:

x = Createobject("excel.application")
x.quit

Keep it open and visible on screen, then run it with Run button in toolbar. It works ok, VFP writes in Command Window "DO test.prg". Run it again as fast as you can. "Syntax error". In command window, VFP tries to run foxuser.dbf.

well... this is not a big deal - no one uses the prgs in this way, but I thought it worth a mention.



>Grigore,
>
>It's probably just the time it takes Excel to finish writing the file to disk, flushing buffers, then the time it take Excel to unload from memory and return the memory to the O/S. This is probably especially true if you are running low on memory and some things have swapped to disk. 2-3 seconds isn't enough to worry about, you might want to provide some feedback to the user that you are waiting for Excel to shut down, before they can continue work.
Grigore Dolghin
Class Software.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform