ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Save File with the current date and time. (https://www.excelbanter.com/excel-programming/346930-save-file-current-date-time.html)

sd

Save File with the current date and time.
 
How can I save a file with the file name as the current date and time?


Norman Jones

Save File with the current date and time.
 
Hi SD,

Try:

'=============
Public Sub Tester04A()

ActiveWorkbook.SaveAs _
Filename:=Format(Now, "yyyymmdd hh-mm") & ".xls", _
FileFormat:=xlWorkbookNormal

End Sub
'<<=============


---
Regards,
Norman


"sd" wrote in message
ups.com...
How can I save a file with the file name as the current date and time?




Vikesh Jain

Save File with the current date and time.
 
Hi Norman,
Just wanted to extend the question. Is there a way whereby:

Step 1- You run a macro for a workbook once where you also specify a
new path
Step 2- After running this macro, Excel creates a backup file for the
selected workbook at the path which you have mentioned in Step 1
Step 3- Now whenever you save the file (Using normal CTRIL+S or
File-Save command), an updated Backup copy of the workbook is created
at the specified path with date and time in the file name.

I want to have the macro so that I can understand the logic and then
customise it for my requirements.

Thanks in advance.



All times are GMT +1. The time now is 04:57 PM.

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