View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ken Ken is offline
external usenet poster
 
Posts: 207
Default Export worksheet to .csv

Omar
I think you just more information about where the .name is supposed to
come from.

Try:

For v = 1 To 7
Sheets(v).Select

ActiveWorkbook.SaveAs Filename:= _
"C:\" & activeworkbook.Name & ".csv", FileFormat:=xlCSV, _
CreateBackup:=False
Next v

Good luck.

Ken
Norfolk, Va



On Sep 27, 2:44 pm, Omar wrote:
I am trying to export multiple worksheets to .csv. This is what I have
so far:

For v = 1 To 7
Sheets(v).Select
ActiveWorkbook.SaveAs Filename:= _
"C:\" & .Name & ".csv", FileFormat:=xlCSV, _
CreateBackup:=False
Next v

When I run the code, I get an error "Method Save As of object
'_WorkBook' failed".

Any ideas on how to fix this?