>Hi,
>
>I have a dbf that i want to export to a excel file. I open the dbf and its contains 33372 records. when i do export to filename type xls (or xl5) only 16384 records are exported to the xls file.
>
>Is that a know problem ? And if so... are there any sollutions ? Are there any other ways to export a dbf to an excel file without losing information ?
>
>Thnx
VFP versions have some limitations with type xls,xl5 (xls is worse - version 2.0).
Solution is not to use xl* but something like csv,dbf or automation.
CSV and Fox2x dbf are natively recognizable by excel. ie:
copy to myFile.csv type csv
copy to myFile.dbf type fox2x
Automation approach is more trustable and you can either provide a live data or snapshot (as does copy to) to excel including memo fields, reccount over 64K excel row limit (good for Pivot tables). ie: A snapshot version (ODBC or OLEDB is fine):
Local oRS as AdoDB.Recordset,oRS2 as AdoDB.Recordset,oCon as AdoDB.Connection
oCon = CreateObject('ADODB.connection')
oCon.ConnectionString = "Provider=VFPOLEDB;Data Source="+_samples+"data\testdata.dbc"
oCon.Open
oRS = oCon.Execute('select * from employee')
oRs.Save('disconnectme.rst')
oRS2 = CreateObject('ADODB.Recordset')
oRs2.Open('disconnectme.rst')
oExcel = Createobject('Excel.Application')
With oExcel
.Workbooks.Add
.Visible = .T.
.ActiveWorkbook.ActiveSheet.QueryTables.Add( oRS2, .Range("A1")).Refresh
Endwith
Erase 'disconnectme.rst'
Cetin