Link to home
Start Free TrialLog in
Avatar of brothertruffle880
brothertruffle880Flag for United States of America

asked on

Excel 2013 VBA - Macro to save a workbook as today's date and time

How can I write a sub so that it saves the current workbook as today's date and current time.
just like this:
2017-12-13 -- 2100.xlsm means that the file was saved on December 13, 2017 9:00 pm

This sub is not working.
What is wrong with it?
Can someone create the above code?

Sub FilenameDateTime()
ActiveWorkbook.SaveAs Format(Now(), "yyyy-m-d  h\.mm.xlsm"), FileFormat:=52
End Sub
Avatar of Subodh Tiwari (Neeraj)
Subodh Tiwari (Neeraj)
Flag of India image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of brothertruffle880


Thanks!  PERFECT!
You're welcome!