Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Opening a EXCEL file on specific worksheet
Message
From
15/09/2008 19:37:28
Luis Santos
Biglevel-Soluções Informáticas, Lda
Portugal
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01332672
Message ID:
01347776
Views:
16
Hello again Sergey

I hope you have nice holidays

On your code that you send to me and work fine , i need to make some modification, because i need to change some value to return my calculate field Cell C14 and what i want is after closing my excel workbook , i use this value field to make a replace for example on my VFOX application.

my code is :
oExcel = CreateObject("Excel.Application")
*Caminho e nome do ficheiro
oWorkbook = oExcel.Workbooks.Open("f:\aaa.xls")
*Nome Da Folha
oSheet = oWorkbook.Sheets("aaa")
*Activate selected sheet
oSheet.Activate()
*Make Excel visible
oExcel.Visible = .T.



*Get value from a cell with some formula
lnSum = oSheet.Cells(12,"c").Value
msg(astr(lnsum))
select lr
replace lr.u_nrchpd with astr(lnsum)
*oSheet.deactivate()
oWorkbook.close

How can change my code to keep the value "lnsum", but only when i close my Excel workbook. I try with :

oExcel = CreateObject("Excel.Application")
*Caminho e nome do ficheiro
oWorkbook = oExcel.Workbooks.Open("f:\aaa.xls")
*Nome Da Folha
oSheet = oWorkbook.Sheets("aaa")
*Activate selected sheet
oSheet.Activate()
*Make Excel visible
oExcel.Visible = .T.


if oWorkbook.close
*Get value from a cell with some formula
lnSum = oSheet.Cells(12,"c").Value
msg(astr(lnsum))
select lr
replace lr.u_nrchpd with astr(lnsum)
oWorkbook.close
endif

But VFPRO return error : " Member CELLS does not evaluate to an object"

Could you give me some help

Many thanks again
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform