Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel
Message
 
À
16/11/1997 13:07:25
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Re: Excel
Divers
Thread ID:
00060557
Message ID:
00061149
Vues:
31
>I have a query whose results I currently send to an Excel
>spreadsheet. Id like to give the users the spreadsheet from
>inside the exe...I can creat a form with an embedded sheet
>easily enough, but how do I order it to read the results
>in?

*****
* The following will open an Excel OLE object, load a template spreadsheet,
* populate the spreadsheet with data from a Fox table and save/print/(other command)
* the spreadsheet
*****

oXLS = createobject("Excel.application")

SELECT * FROM dataTable INTO CURSOR Tmp
SELECT Tmp

oXLS.Workbooks.Open("Template.XLS")
oXLS.Sheets(1).Activate
oXLS.Cells(6,5).Value = 'Title or Variable value'

*****
* Start of data area in spreadsheet
*****
lnRow = 13
SCAN WHILE !EOF()
oXLS.Cells(lnRow,2).Value = Tmp.Name
oXLS.Cells(lnRow,3).Value = Tmp.Social
oXLS.Cells(lnRow,5).Value = Tmp.ReviewDate
oXLS.Cells(lnRow,6).Value = Tmp.Rating
oXLS.Cells(lnRow,7).Value = Tmp.AnnSalary
lnRow = lnRow + 1
ENDSCAN

oXLS.ActiveWorkBook.SaveAs(lcFile, 39 ) && 39=Excel 5 format, 33=Excel 4 format
oXLS.ActiveWorkBook.Close(0)
oXLS.Quit
RELEASE oXLS

RETURN
Mike Kelly
Venture Catalyst Group, Inc.
http://www.vcatgroup.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform