We posted a tip on this in the May 2002 Newsletter at
VFUG (
http://vfug.org:8080/ ).
Here it is (with proper credit given to the author):
Overcoming Excel's 16,384 Line Limit
************************************
If you try to copy a DBF to an Excel spreadsheet using the
COPY TO Myfile.xls TYPE XL5
command, you'll find that only the first 16,384 lines are exported. The following code breaks up a dbf into 'chunks' of 16,383 lines and copies each segment to a different spreadsheet. You can either use copy/paste to bring the data together or use OLE Automation.
*-----------------------------------------------------------------------*
* CreateXls breaks up a copy of a table into Excel spreadsheets.
*-----------------------------------------------------------------------*
LPARAMETERS pSourceTbl, pSourceAls, pXlsFile
StartAt = 1
MaxXlsRows = 16383 && MAX NUMBER OF EXCEL ROWS IN EXCEL 97 not including header
EndAt = MaxXlsRows
USE (pSourceTbl) ALIAS (pSourceAls) IN 0 // You may have a preferred way to select a table
IF RECCOUNT() < MaxXlsRows
COPY TO ((pXlsFile + ".Xls")) TYPE XL5
ELSE
FOR XlsLoopCtr = StartAt TO CEILING(RECCOUNT()/MaxXlsRows)
XlsFile = pXlsFile + LTRIM(STR(XlsLoopCtr,2)) + '.Xls'
COPY TO (XlsFile) TYPE XL5 FOR BETWEEN(RECNO(),StartAt,EndAt)
StartAt = StartAt + MaxXlsRows
EndAt = EndAt + MaxXlsRows
NEXT XlsloopCtr
ENDIF
RETURN .T.
Bill Koretoff
==Carl
Carl J. WarnerVFUG OfficerThe early bird gets the worm, but the second mouse gets the cheese.