Information générale
Catégorie:
Gestionnaire de rapports & Rapports
>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
......
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement