Thursday, May 22, 2008

Save Excel to Excel 5

Foxpro gives error "Invalid Excel file format", when appending from Excel file which was created in mac version. To append this file, we need to save it in older version (Excel 5).
I use the following code to save file in Excel 5.


lcx = Getfile('xls')

lcfname = JUSTFNAME(lcx)

lcsave = FULLPATH(CURDIR()) +lcfname + '_5.xls'
loExcel = CREATEOBJECT("Excel.Application")
lowb = loExcel.Workbooks.Open(lcx)
lowb.SaveAs(lcsave, 39)
loexcel.Quit()
loexcel = null

No comments: