MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Using sheet name in save as

Posted by BB on December 03, 2001 1:35 PM

I am needing to resave each .csv file with the current worksheet name. I recorded a macro (see below), but need the file name to be the current worksheet name. Can anyone help me add code to use current worksheet name?

Sub ReSave_csv_File()
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\bbabine.NA04\My Documents\101001\v32691.csv" _
, FileFormat:=xlCSV, CreateBackup:=False
End Sub

Posted by Paulie on December 03, 2001 2:50 PM

Try this change to your code:

NameOfSheet = ActiveSheet.Name