SaveAs "Filename"_1

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
Back
Top