ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   SaveAs "Filename"_1 (https://www.excelbanter.com/excel-discussion-misc-queries/151539-saveas-filename-_1-a.html)

Dave

SaveAs "Filename"_1
 
Hi Guys,

I'm looking for a line of code to add into a macro that will save the open
workbook (lets call it workbook1) in the format of

Filename_1 e.g. Workbook_1

I'm sure its simple but I'm having a blank.

Thanks!
Dave

Pete_UK

SaveAs "Filename"_1
 
If you just want to save the workbook with its current name
(overwriting an earlier version), then try this:

Application.DisplayAlerts = False
ActiveWorkbook.Save
Application.DisplayAlerts = True

The Application.DisplayAlerts = False will overwrite without
giving you a warning.

Alternatively, if you want to save the file with a different name,
then try this:

ActiveWorkbook.SaveAs Filename:= _
full_path & "Workbook_1.xls", _
FileFormat:=xlNormal, Password:="", _
WriteResPassword:="", _
ReadOnlyRecommended:=False, _
CreateBackup:=False

Just one statement - I've split it here to avoid awkward line breaks
in the newsgroups.

full_path is a string which you should have declared earlier - fairly
obvious what it is for.

Hope this helps.

Pete

On Jul 24, 10:30 pm, Dave wrote:
Hi Guys,

I'm looking for a line of code to add into a macro that will save the open
workbook (lets call it workbook1) in the format of

Filename_1 e.g. Workbook_1

I'm sure its simple but I'm having a blank.

Thanks!
Dave





All times are GMT +1. The time now is 04:01 AM.

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