Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Import data fromExcel (multiple sheets)
Message
From
12/04/2006 05:19:28
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01112782
Message ID:
01112788
Views:
13
Thanks Borislav and Martin. Got it!


>>Hi All
>>
>>I know this has all been asked before but as usual I'm looking for some fast pointers to get the ball rolling quickly :) I have an Excel spredsheet. it has four pages/tabs. I wish to extract all the data on each page and dump all cells into a DBF file, one DBF file per page/tab. Any quick ideas to get going?
>>
>>Thanks
>
>One way:
>
>#define xlDBF4 11
>LOCAL oExcel AS Excel.Application, lcDBFName
>oExcel = CREATEOBJECT([Excel.Application])
>oExcel.WorkBooks.Open([MyXLS.xls])
>oExcel.DisplayAlerts = .f.
>FOR EACH oSheet IN oExcel.ActiveWorkBook.Sheets
>    oSheet.Activate
>    oExcel.Range([A1]).Select
>    oSheet.SaveAs(oSheet.name,xlDBF4)
>NEXT
>oExcel.ActiveWorkBook.Close()
>oExcel.Quit()
>oExcel = NULL
>
>
>Of course if you know the exact sheet names and the Exact Sheet counts you could always do:
>IMPORT FROM MyXls XL5 SHEET Sheet1 (real name of the sheet here)
>IMPORT FROM MyXls XL5 SHEET Sheet2
>etc.
In the End, we will remember not the words of our enemies, but the silence of our friends - Martin Luther King, Jr.
Previous
Reply
Map
View

Click here to load this message in the networking platform