I recorded a macro in excel to see how this might be done, and found that it requires the following:
ActiveWorkbook.SaveAs Filename:= _
"myfile.csv" _
, FileFormat:=xlCSV, CreateBackup:=False
I tried using the 'SaveAs' method of excel's worksheet class through activex. I've tried the following syntax with no luck:
invoke(exsheet,'SaveAs','myfile.csv') %Writes a binary excel file to the csv filename
invoke(exsheet,'SaveAs','myfile.csv', 'xlCSV') %Throws an error b/c too many inputs
invoke(exsheet,'SaveAs',{'myfile.csv', 'xlCSV'}) %writes an xls file to myfile.csv, and writes xls to xlCSV as well
set(exsheet,'FileFormat','xlCSV')
Here is how I am doing this operation:
Excel = actxserver('Excel.Application');
Excel.Workbooks.Open('myfile.xls');
Excel.ActiveWorkbook.SaveAs('myfile.csv', 6);
where 6 is the Excel constant conformable to xlCSV.
Hope it helps.
"Brian " <skinny.leg...@gmail.com> wrote in message <gpea0h$okb$1...@fred.mathworks.com>...
"Nomad " <no...@nomad.com> wrote in message <gui1q9$33u$1...@fred.mathworks.com>...
> Brian,
>
> Here is how I am doing this operation:
>
> Excel = actxserver('Excel.Application');
> Excel.Workbooks.Open('myfile.xls');
> Excel.ActiveWorkbook.SaveAs('myfile.csv', 6);
>
> where 6 is the Excel constant conformable to xlCSV.
>
> Hope it helps.
>
>
>
> "Brian " <skinny.leg...@gmail.com> wrote in message <gpea0h$okb$1...@fred.mathworks.com>...
> > I'm trying to write a program in matlab that will have excel create a CSV file based on an existing spreadsheet, but I'm having trouble coaxing the activex interface into saving an xls file as a csv file. Here's what I've done so far:
> >
> > I recorded a macro in excel to see how this might be done, and found that it requires the following:
> >
> > ActiveWorkbook.SaveAs Filename:= _
> > "myfile.csv" _
> > , FileFormat:=xlCSV, CreateBackup:?lse