>Hello,
>
>We often use the COPY TO ... TYPE XL5 command to export the content of VFP cursors and tables to Excel worksheets. Lately we have seen that these worksheets had a maximum of 16384 rows although our cursors have more than that.
>Is there any limit to the total count of rows VFP can export? We use VFP 5.0
>
>Fausto
Yes. 16384. You can use DATATOCLIP and paste segments to get more total rows via automation.
Say you can get 5,000 records into the clipboard at one time out of 75000:
oExcel = CREATEOBJECT("Excel.Application")
oExcel.Sheets("Sheet1").Select()
nMaxRecs = 5000
SELECT * FROM yourtable ;
WHERE whateveryouneed ;
INTO CURSOR temp1 NOFILTER
nTotal = _TALLY
nSegment = INT(nTotal/nMaxRecs)
FOR x=1 TO nSegment
nStart = (x-1) * nMaxRecs + 1
nEnd = x * nMaxRecs
SELECT * FROM temp1 ;
WHERE BETWEEN(RECNO(),nStart,nEnd) ;
INTO CURSOR temp2
_VFP.DATATOCLIP(,,3)
oExcel.ActiveSheet.Cells(nStart, 1).Select()
oExcel.ActiveSheet.Paste()
ENDFOR
oExcel.ActiveWorkbook.Save()
oExcel.ActiveWorkbook.Close()
oExcel.Quit()