Thread: SaveAs csv
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Damien McBain[_3_] Damien McBain[_3_] is offline
external usenet poster
 
Posts: 28
Default SaveAs csv

Gert wrote:

Hi,

I have to save one specific sheet (or a copy of this sheet) as a scv
file but at the same time I want to keep the original workbook a xls
file.
Is it possible to do this with a macro ???

thanks in advance
Gert


Sub saveascsv()

Dim SaveName
SaveName = "C:\mycsvfile.csv" 'you can refer to a range.text if you want to
make this dynamic

Worksheets("Sheet1").Copy
Workbooks(Workbooks.Count).Activate
Workbooks(Workbooks.Count).SaveAs SaveName, xlCSV
Workbooks(Workbooks.Count).Close SaveChanges:=False

End Sub