Avatar of brothertruffle880
brothertruffle880
Flag 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
VBAMicrosoft ExcelMicrosoft Office

Avatar of undefined
Last Comment
Subodh Tiwari (Neeraj)

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Subodh Tiwari (Neeraj)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
brothertruffle880

ASKER
Thanks!  PERFECT!
Subodh Tiwari (Neeraj)

You're welcome!
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck