Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Another EXCEL issue
Message
From
11/11/2003 04:06:17
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00848521
Message ID:
00848617
Views:
14
>Hello,
>
>I want to access several cells in excel sheets. I can't do this by importing. Can someone show me a sample with accessing it with the oExcel object?
>
>I don't know how the excel will be named but I need to know that too.
>Thanks, Ionut
lcXLS = GetFile('XLS')
oExcel = CreateObject('Excel.Application')
oExcel.Workbooks.Open(lcXLS)

*Up to this point you opened a workbook and have an ActiveWorkbook object.

*Assuming you'd access to cells in G4:J20 :

with oExcel.Activeworkbook.ActiveSheet.Range('G4:J20')
    For ix = 1 to .Rows.count
      For jx = 1 to .Columns.count
        ? .Cells(ix,jx).Value
      Endfor
    Endfor
endwith
PS: If you'd get all the cell values in Used Range then you'd use :
with oExcel.Activeworkbook.ActiveSheet.UsedRange

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform