Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
EXCEL to DBF - MODIFY - return to EXCEL
Message
From
01/07/2003 05:34:53
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
30/06/2003 15:58:31
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00805454
Message ID:
00805616
Views:
28
>The last part, the modify and to copy a table to type xls format is easy, but is there any easy way to open an excel file as a formated table in VFP so that I can modify, add columns, etc. then return the results to excel. The only part I would need to know is how to open an excel file up as a table in VFP or somehow copy it in a way to convert it that I can open it.

Kevin,
An excel file might be in a format that's incompatable with VFP. If you're sure it'd always be you could simply saveas a fox2x dbf. ie:
lcXLS = getfile('XLS')
lcfilename = SYS(5)+CURDIR()+'FromExcel.dbf'

oExcel = CREATEOBJECT('excel.application')
with oExcel
  .Displayalerts = .f.
  .WorkBooks.Open(lcXLS)
  .ActiveWorkBook.SaveAs(lcfilename,8)
  .Activeworkbook.saved = .t.
  .Quit()
endwith
This saves a workbook (active-first sheet) as a dBaseIII (fox2x) file. Columns are automatically named as A,B.... and types are set. After modification you could simply write over old xls as type xl5.

However his would work with only strict formats and limited rows. Depending on your purpose it might be easier to open in excel and directly do modification there with automation.
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
Reply
Map
View

Click here to load this message in the networking platform