File Names

S

Sharon Perez

I want to know if a macro can save a file with the name of
today's date, and and if so how is that done. Thanks!
 
R

Ron de Bruin

Hi Sharon

Try this

One way to save a copy of the file in C:\ with a date-time stamp
You can also use SaveAs

Sub test()
Dim strdate As String
strdate = Format(Now, "dd-mm-yy h-mm-ss")
With ThisWorkbook
.SaveCopyAs "C:\Copy of " & .Name _
& " " & strdate & ".xls"
End With
End Sub
 
B

Bob Phillips

actuveworkbook.save filename:= "C:myDir\" & Format(Date,"yyyy-mmm-dd") &
".xls"

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Top