Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Reading Excel file from Foxprog
Message
De
13/08/2002 04:19:01
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
13/08/2002 02:46:59
Ashish Patel
Hindustan Petroleum
Mumbai, Inde
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00688995
Message ID:
00689007
Vues:
18
>Hi
>
>I want to read excel file which has many sheets from my visual foxpro prog.
>Depedning on values in certain cell of excel sheet I want to update fields of fox table. I also ant to know how to read certain range e.g. from b2:b500. How can I read cell values using from within loop. i.e. I don't want to hard code my prog. Can I do this from Foxpro.
>
>Thanks in Advance.
>
>
>Ashish Patel

Ashish,
You could loop in range. ie:
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
However if your range is big, keep in mind looping in Excel with VBA is very slow. Instead you could just get a copy of sheet as type fox2x and process a dbf.
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform