Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Export a dbf to a xls or xl5
Message
From
09/03/2005 08:05:45
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
08/03/2005 16:43:02
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00993820
Message ID:
00993947
Views:
28
This message has been marked as the solution to the initial question of the thread.
>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
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform