Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Import From Excel
Message
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00901601
Message ID:
00901653
Views:
30
This message has been marked as the solution to the initial question of the thread.
If you can live with importing a CSV instead of an Excel Spreadsheet (you would need to have the structure made before hand) you can do this:
ox = CREATEOBJECT("excel.application")
ox.Workbooks.Open(CURDIR() + "test.xls")
ox.ActiveWorkbook.SaveAs(CURDIR()+"test2.csv",24)
and then APPEND FROM the csv.

Another option is to convert the file in excel and import the excel file. This will preserve the functionality you have now which does not require you to know the structure before hand. Here's an example of how you might accomplish this but you will probably have to clean it up a bit.
ox = CREATEOBJECT("excel.application")
ox.Workbooks.Open(CURDIR() + "test.xls")
ox.ActiveWorkbook.SaveAs(CURDIR()+"test2.csv",24)
ox.ActiveWorkbook.Close(.F.)
ox.Workbooks.Open(CURDIR()+"test.csv")
ox.ActiveWorkbook.SaveAs(CURDIR() + "test2.xls",-4143)
ox.ActiveWorkbook.Close(.f.)
IMPORT FROM test2.xls TYPE xl8
Note how this uses excel to create the csv as before and then converts the csv BACK to an xls. This gets rid of all the formulae and converts them to straight values. Then you can import from there.

I know this is kind of an ugly solution and maybe someone will chime in with something more elegant. But it could get the job done.

Hope this helps.

Menachem

>Sorry, I probably don't explain things well with a keyboard.
>
>In column 'A' there is a formula: =CONCATENATE(J2,K2) The result of this should be: S-3314PH4TAB-MOT-M-1A-201 But instead I get: S-3314PH4TAB-MOT-M-1A-20
>
>Col J = S-3314PH4TAB-MOT-
>Col K = M-1A-201
>
>I know I could fix this after. But How do I avoid this?
>
>
>Mike
Menachem Bazian, CPA
President
BC Consulting Services, Inc.
973-773-7276
Menachem@BazianCentral.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform