Information générale
Catégorie:
COM/DCOM et OLE Automation
>How can I open a new worksheet through Visual Fox Pro in EXCEL, put some values in some cells and automatically save the worksheet in a certain filename.xls
Petros,
Here's the basic commands to get you going:
* Open Excel and make it visible
oExcel = CreateObject("Excel.Application")
oExcel.Visible = .T.
* Add a workbook
oWorkbook = oExcel.Workbooks.Add()
* Grab a reference to the first worksheet
oSheet = oWorkbook.Sheets[1]
* Add some values
WITH oSheet
.Range("A1").Value = "A"
.Range("B1").Value = 1
* and so on...
ENDWITH
* Now save it
oWorkbook.SaveAs('c:\mypath\filename.XLS')
* Now clean up
oExcel.Quit
RELEASE oExcel, oWorkbook, oSheet
This should get you started.
- della Martin
Précédent
Suivant
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