Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Update Excel Cell thru VFP
Message
 
To
12/04/2000 14:26:06
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00358843
Message ID:
00358868
Views:
11
>Hi,
>
>How could I go about update specific cell in Microsoft Excel thru VFP?
>All I want to do is to create a form with two textbox(One for the Row, One for Column) and a button. By pressing on the button it will auto update the excel's row & column with the new values (two textbox).
>
>The other solution I need is to select specific sheet from the spreadsheet. Any help or suggestion will be appreciated.
>
>Thanks.

For example:

LOCAL lcFile
lcFile = "c:\temp\mytestfile.xls"
PUBLIC oExcel
oExcel = CREATEOBJECT("Excel.Application")
oExcel.WorkBooks.OPEN(lcFile)
lnExcelRow = THISFORM.textbox1.VALUE
lnExcelCol = THISFORM.textbox2.VALUE
oExcel.Worksheets("Sheet1").ACTIVATE()
* OR:
* oExcel.Worksheets(1).ACTIVATE()
WITH oExcel.ActiveWorkbook.ActiveSheet
     .Cells(lnExcelRow,lnExcelCol ).VALUE = somevalue
     *.... more cells here
ENDWITH
oExcel.Worksheets("Sheet2").ACTIVATE()
* OR:
* oExcel.Worksheets(2).ACTIVATE()
* now set some cells values in Sheet2...



HTH,

Nick
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform