Thread: SaveAs csv
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
FSt1 FSt1 is offline
external usenet poster
 
Posts: 3,942
Default SaveAs csv

hi,
yes it is. but you left out some critical info. Is the cvs file going to
always have the same name? here are 2 possible ways. change and don't change.

Sub mac1SaveRange()
Sheets("Sheet1").activate ' change this to your sheet name
Cells.Select
Selection.Copy
Workbooks.Add
Range("A1").Select
ActiveSheet.Paste
Range("A1").Select
Application.CutCopyMode = False
'use this code if the name DOES NOT change
'ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\My Documents\XCEL\deleteme.csv", _
FileFormat:=xlCSV, CreateBackup:=False
'change deleteme to your file name.
'use this code if the name DOES change
'Application.Dialogs(xlDialogSaveAs).Show
end sub

Post back if you have problems. I will be going to work soon and probably
wont be back to news groups until tonight. But I'll check to see.

Regards
FSt1
"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