Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Accessing Excel Sheet
Message
 
To
23/09/2002 05:25:48
Ashish Patel
Hindustan Petroleum
Mumbai, India
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00703274
Message ID:
00703291
Views:
25
This might do it for you (you would have to modify your own code to refer to the active sheet:

LOCAL myActivesheet,oWb
lcXLSFile = 'c:\book1.xls'
lcRange = "b2:b500"
oExcel = CREATEOBJECT("excel.application")
oWb= oExcel.Workbooks.OPEN(lcXLSFile)
myActiveSheet=oExcel.Application.WorkBooks(1).workSheets("sheet2")
myActiveSheet.activate
oExcel.visible = .t.


>I am using the following code to access Excel File from Visual Foxpro prog which I received from UT only. Thanks for that. Since my excel file is having multiple worksheets how can I point to a particular work sheet?
>--------------------------------------------------------------------------
>lcXLSFile = 'c:\path\YourXls.xls'
>lcRange = "b2:b500"
>oExcel = createobject("excel.application")
>With oExcel
> .Workbooks.open(lcXLSFile)
> With .ActiveWorkbook.ActiveSheet.range(lcRange)
> For ix = 1 to .Rows.count
> For jx = 1 to .Columns.count
> ? .Cells(ix,jx).Value
> Endfor
> Endfor
> Endwith
> .quit
>Endwith
>-----------------------------------------------------------------------------
>
>Thanks in Advance.
>
>Regards
>
>Ashish Patel
Previous
Reply
Map
View

Click here to load this message in the networking platform