macro to save as a unique name each time

  • Thread starter Thread starter Hegler
  • Start date Start date
H

Hegler

I have a co-worker wanting to create a macro so that the
end user can click a button to save the Excel file as a
unique name each time. My first thought was to see if
there was a way that when you do file\save as the date and
time can be appended to the file name. Is this possible?
If so, how? If not, does anyone else have any suggestions
as to how to make Excel save the file as a unique name
each time the button is pushed (macro is run)?
 
Hi Hegler

Try this

Sub test()
Dim strdate As String
strdate = Format(Now, "dd-mm-yy h-mm-ss")
ActiveWorkbook.SaveAs "C:\" & ThisWorkbook.Name _
& " " & strdate & ".xls"
End Sub
 
Hegler, how about something like this

Sub Save_Sheet()
'saves the sheet with My Workbook For and today's date
Dim MyName As String
MyName = "My Workbook For " & Format(Now, "mmm-dd-yyyy") & ".xls"
ActiveWorkbook.SaveAs Filename:=MyName

End Sub

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 97 & 2000
** remove news from my email address to reply by email **
 
Back
Top