ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   File Names (https://www.excelbanter.com/excel-programming/306125-file-names.html)

Sharon Perez

File Names
 
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!

Ron de Bruin

File Names
 
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


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Sharon Perez" wrote in message ...
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!




Bob Phillips[_6_]

File Names
 

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)

"Sharon Perez" wrote in message
...
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!






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

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