ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with SaveAs (https://www.excelbanter.com/excel-programming/289602-help-saveas.html)

Glen Mettler[_2_]

Help with SaveAs
 
Using Excel 2002
I have the following macro to save a worksheet as a CSV file:
For s = 2 To 9
Sheets(s).Select
sheetName = ActiveSheet.Name
ActiveSheet.Copy

ActiveWorkbook.SaveAs filename:=csv_path & "\" & sheetName & ".csv",
FileFormat:=xlCSV
ActiveWorkbook.Close Savechanges:=False
Next

I get the message that the CSV file already exists - do I want to save
anyway for each sheet it attempts to create.

How can I code it to "overwrite" so I don't get that message? I can't seem
to find anything in the help file that tells me that.

Thanks,
Glen



Nigel[_8_]

Help with SaveAs
 
Place the following around your save

Application.DisplayAlerts = False
ActiveWorkbook.SaveAs filename:=csv_path & "\" & sheetName &
".csv",FileFormat:=xlCSV
Application.DisplayAlerts = True

HTP
Cheers
Nigel

"Glen Mettler" wrote in message
...
Using Excel 2002
I have the following macro to save a worksheet as a CSV file:
For s = 2 To 9
Sheets(s).Select
sheetName = ActiveSheet.Name
ActiveSheet.Copy

ActiveWorkbook.Close Savechanges:=False

Next

I get the message that the CSV file already exists - do I want to save
anyway for each sheet it attempts to create.

How can I code it to "overwrite" so I don't get that message? I can't

seem
to find anything in the help file that tells me that.

Thanks,
Glen






----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---


All times are GMT +1. The time now is 03:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com