Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Very Slow creation of Excel Object
Message
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00220302
Message ID:
00220334
Views:
29
>I have been trying to send data to an Excel Object as follows and it takes about 2 minutes per 100 records. Is there anything I can do to speed it up
>
>n= 0
>SCAN
> n = n+1
> oExcel.Cells(1,n) = FirstName
> oExcel.Cells(2,n) = LastName
> oExcel.Cells(3,n) = Address1
> oExcel.Cells(4,n) = Address2
>ENDSCAn

Russel,

In addition to what Chen said. For small data sets, using clipboard to cut and paste is much faster. If your data set will exceed the clipboard size limit then saving to either an excel file from VFP or saving as DBF and opening the DBF from Excel will be fast as well. The advantage of opening a DBF from Excel is that you can exceed the 16384 row limit. When writing an Excel file from VFP it crops data past 16384.

Also when communicating to Excel via OLE you should make use of the WITH command to reduce call time overhead.
WITH oExcel
n= 0
SCAN
   n = n+1
   .Cells(1,n) = FirstName
   .Cells(2,n) = LastName
   .Cells(3,n) = Address1
   .Cells(4,n) = Address2
ENDSCAN
ENDWITH
Michael McLain
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform