It would be handy if I could tell Excel to open a file and resave it as a CSV file without making the user do it, or having to write a program to do this. Does it provide any such functionality?
3 Answers
This link has some of the command line options, and there's some different ones added in here.
Some good info in this post.
I don't think it can be done without a macro of some kind. There are a few ways to do it, but the simplest is just to code it into the Workbook_Open method.
- 8,837
This is easily done in VBA - it can actually be done with just one line of code, but the circumstances around how you want it to happen will be where you need to do the work.
One option would be to create a custom button and add it to a toolbar. Another is to automatically save a copy of the file when the user saves the Excel workbook. There are several "events" (save, close, open, etc) that you can tie VBA code to. The line in question is:
ActiveWorkbook.SaveAs FileName:= "myFileName", FileFormat:= xlCSV
If you had some more specific goals of when/how you wanted this save event to happen, I could add some more to this post in the future.
- 1,183
alternatively, you could use a perl script to do it, like this one: http://search.cpan.org/~ken/xls2csv-1.06/script/xls2csv
- 761