troubleshooting Question

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

Avatar of brothertruffle880
brothertruffle880Flag for United States of America asked on
VBAMicrosoft ExcelMicrosoft Office
3 Comments1 Solution157 ViewsLast Modified:
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
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros