Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Very Slow Second Sheet
Message
De
21/04/2017 08:45:55
 
 
À
20/04/2017 19:23:44
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
01650494
Message ID:
01650504
Vues:
59
>Hi All:
>
>I'm trying to process an Excel spreadsheet via VFP 9. I've got a main form which sets up some parameters and an OK button to start the processing. In the OK button I have
>oxl = CREATEOBJECT("excel.application")
>oxl.displayalerts = .F.
>oxl.workbooks.add
>owb = oxl.activeworkbook
>.
>.
>.
>If thisform.chkDetail.value
>    thisform.mCreDtl
>    thisform.mCreDtlMYR
>ENDIF
>.
>other similar calls.
>.
>
In the beginning of each of the two methods I have
>owb.Sheets.Add  && owb from calling button
>osh = owb.ActiveSheet
>osh.name = 'Creditors Detail'
>
>r1 = 1
>rb = r1
>    
>
>WITH osh
> etc
>
>The two methods are very similar and process roughly the same amount of data. The first one (mCreDtl) is slow, but not unreasonable -- about 2 minutes.
>The second one (mCreDtlMYR) takes almost fifteen minutes to complete.
>
>Because the two methonds are not dependent on each other, I can reverse the sequence in which they are called.
>I do that with the same results. The first one to run (mCreDtlMYR) is slow, but not unreasonable.
>The second one (mCreDtl) takes almost fifteen minutes to complete.
>
>I tried forcing osh to NULL at the end of the methods, but that had no impact.
>I've also tried a FLUSH and SYS(1104), but that had no impact.
>
>My only thought at the moment is to save each worksheet in a separate file, close XL at the end of each method and then try to combine them into one spreadsheet
>once the individual methods have completed.
>
>Is there other approach I can take to get the processing up to speed?
>

Not sure what's going on, but in general, COPY TO followed by opening a workbook is much faster than populating it cell by cell. So I think you can speed both pages up by writing out new workbooks, and then using copy/paste to move the date where you want it.

Tamar
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform