>Pertti
>
>Thanks.
>
>DO you find that importing the 95 format always works? Using your solution and your fileformat tip, to save it as a comma delimited text file becomes:-
>
>
>loxl.DisplayAlerts = .F.
>loxl.ActiveWorkbook.SaveAs("c:\MyExcel95File.txt",6)
>
>
>I wonder which is the better format to use to import into VFP.
Cyril:
You are welcome. I don't think it should matter much
in principle, except maybe in date fields, where CSV might give you a different result than DBF. I think there are a few other potential pittfalls, too, having to do with numbers.
I personally find a DBF file easier to read than a CSV file, because DBF has fixed columns. Also, for further manipulation, e.g., sorting, grouping, creating calculated fields etc., DBF is much better and easier. Assuming that you need to do "post-processing" on the imported data.
So, for those reasons alone I always go with the DBF file, especially these days when disk space is really a non-issue...
Pertti
>
>Cyril
>
>>>Pertti
>>>
>>>Do you do the SaveAs into 5.0/95 format programatically? If yes, can you show how?
>>>
>>>Cyril
>>
>>Cyril:
>>
>>This oughta do the trick:
>>
>>
>>loxl = CREATEOBJECT('excel.application')
>>loxl.workbooks.Open("C:\MyExcel2007File.xls")
>>loxl.ActiveWorkbook.SaveAs("c:\MyExcel95File.xls",39)
>>
>>
>>Save As code 39 saves your file in Excel 5/95, and then you can import it to VFP without any problems. The dumb thing is that it is very, very difficult to find this code. I looked high and low, and finally saved 2007 spreadsheet manually as 95 spreadsheet, then opened it in VFP and queried the filetype with:
>>
>>
?loxl.ActiveWorkbook.fileformat
>>
>>
>>Pertti
>>
>>>
>>>
>>>>Scott,
>>>>
>>>>I've been using SaveAs into 5.0/95 format. ODBC, as Cetin mentioned, is another route that avoids saveas, but is not nearly as convenient and flexible as IMPORT XLS.
>>>>
>>>>
>>>>Pertti
>>>>
>>>>>I'm having trouble using the IMPORT command in VFP9 to load Excel 2007 files. I'm not surprised that the .XLSX extension files fail, but even files saved in newer formats than 5.0/95 seem to fail if they were created by Excel 2007.
>>>>>
>>>>>What alternatives are available for importing Excel files created by or saved by Excel 2007 into VFP9?
>>>>>
>>>>>- Manually using SaveAs
>>>>>- Automation: SaveAs
>>>>>- Automation: Cell by Cell access
>>>>>
>>>>>Others?
>>>>>
>>>>>Also, I noticed that Advisor has a workaround (
http://my.advisor.com/doc/19289) but my subscription expired last year. Anyone know the solution they suggested?
>>>>>
>>>>>Thanks,
>>>>>Scott