Excel 2007- Save tabs as CSV

A

Amit

Hi guys, i'm working with Excel 2007, and i need to save a workbook
with about 15-20 TABS into CSV files, meaning: every tab to a new CSV
file. I've tried to search for an application but i didn't find
something good enough that actually working. Can you guys please
advise?
Thanks,
Amit Goldberg
Israel
 
M

macropod

Hi Amit,

Try the following macro:
Sub SaveAllSheets2CSV()
Dim wsSheet As Worksheet
With ActiveWorkbook
For Each wsSheet In .Worksheets
wsSheet.SaveAs Filename:=.Path & "\" & wsSheet.Name, FileFormat:=xlCSV, AddtoMRU:=False
Next wsSheet
End With
End Sub

Cheers
 
A

Amit

Hey,
Thanks for the VB code, but can you please guide where i should put
the target folder?
Because it gives me an error now...

Thanks again,
Amit.
 
M

macropod

Hi Amit,

The macro is coded to automatically put the CSV files into the same folder as the workbook was opened from. The only way I can
induce an error is if the Excel workbook is a new one that hasn't ever been saved, or if the workbook is in a read-only folder. If
you want to use another folder, change '.Path' to the folder name, or use a find_folder routine to let the user choose a folder.

Cheers
 
Top