8

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?

1
  • I see how to do it, but not without some macro/VBA programming. Sep 21, 2010 at 21:35

3 Answers 3

4

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.

3
  • 5
    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, 2010 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. Sep 17, 2010 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? ;-) Sep 17, 2010 at 20:21
0

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.

0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .