Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DBF to fomatted xls spreadsheet
Message
 
To
04/08/2003 12:34:04
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00816537
Message ID:
00816954
Views:
30
>To whom it may concern:
>
>I would like some input on how to copy data to an already formatted excel spreadsheet. This is something for very new to me. So if any has any ideas please email me back. Thanks in advance.
>
>Kimberly

Kimberly,

I believe that the most suitable method here is to use Excel automation to pull external data into Excel, like:

ObjExcel= getOBJECT(,"Excel.Application")
ConnectionString="ODBC;DSN=Visual FoxPro Tables;UID=;PWD=;SourceDB=c:\foxwork\vfpapps;SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;"

sqlquery="SELECT msprod from msconst"

xlOverwriteCells=0
with ObjExcel.ActiveSheet.QueryTables.Add(;
ConnectionString,;
ObjExcel.ActiveSheet.Range("B6"),;
sqlquery)
.FieldNames = .f.
.RefreshStyle = xlOverwriteCells
.RowNumbers = .f.
.FillAdjacentFormulas = .f.
.HasAutoFormat = .f.
&& other options may go here to preserve formattings; record a macro in Excel to see details

.Refresh

endwith
......
Previous
Reply
Map
View

Click here to load this message in the networking platform