Can you open the file manually, then record the macro to save it correctly?
>Hi,
>I have a program to read in a .CSV file which the column fields separated by comma,
>and I want to convert it to a Excel File. (one column for one field)
>The following is the code:-
>
>
>crptfile="C:\TEMP\CLIENT.CVS"
>ctargetfile="C:\TEMP\CLIENT.XLS"
>TRY
> oExcel = CREATEOBJECT([Excel.Application])
> oWorkbook = oExcel.Workbooks.open(crptfile)
> oExcel.Visible = .t.
> oWorkbook.Window[1].Activate()
> oExcel.ActiveSheet.Range("A1:K1000").Columns.AutoFit()
> oWorkbook.SaveAs(ctargetfile)
>CATCH
> MessageBox([There is no EXCEL installed])
>ENDTRY
>
>
>the worksheet prompt out in Excel is normal, one column for one field,
>After exit Excel application, I reopen the excel, I find that although the target file is Excel format,
>the detail is still in cvs format, only the first column contain the data.
>for example in the first column contain "aaa,bbb,ccc,ddd,...",
>I suppose column A1 contain "aaa", column B1 contain "bbb", column C1 contain "ccc".....
>
>How to solve this problem, please advise.
>
>Thanks
>Derek Yim
If it's not broken, fix it until it is.
My Blog