Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
    
I see how to do it, but not without some macro/VBA programming. –  Lance Roberts Sep 21 '10 at 21:35
add comment

3 Answers

alternatively, you could use a perl script to do it, like this one: http://search.cpan.org/~ken/xls2csv-1.06/script/xls2csv

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
4  
any chance you could enumerate any relevant cmd line options in your answer, to help the OP directly? As a bonus, this protects the answer against future link rot as well. –  DMA57361 Sep 17 '10 at 9:11
    
@DMA, I'm actually very interested in this question and plan to dive more into it this next week when I get back to work. I was just trying to direct him so that he might be able to figure out a trick himself. I think he probably will have to create a separate macro file and open that when he opens the file he cares about, but not sure yet. –  Lance Roberts Sep 17 '10 at 17:54
    
I'm tempted to add the missing info myself :-). Instead, I'll upvote Lance's answer hoping he'll do it himself next week. But better than getting paid for while filling the gaps in stackoverflow? ;-) –  Kurt Pfeifle Sep 17 '10 at 20:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.