General information
Category:
COM/DCOM and 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
Previous
Next
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