Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel Export
Message
 
 
To
06/10/2000 08:01:46
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Miscellaneous
Thread ID:
00425832
Message ID:
00425835
Views:
22
>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
Map
View

Click here to load this message in the networking platform