General information
Category:
Reports & Report designer
>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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only