troubleshooting Question

VBA: Save the active worksheet to a file name to include current year followed by active worksheet tab name

Avatar of Berry Metzger
Berry MetzgerFlag for United States of America asked on
Microsoft Excel
2 Comments1 Solution640 ViewsLast Modified:
Hello Experts:
The following macro, in Module 1 of a XLSM file, falls short of the goal... to save the active worksheet, sans macros, to a file in the same directory as the active file, with a name that begins with a fixed text "WTS_" followed by current year, "_", tab name of active sheet, ".xls".    

Resultant filename will look similar to:  "WTS_2012_7-8"

Thanks for your help    

Dim sCopyName As String
         sCopyName = "WTS_" & Format(Now, "yyyy") &"_"&{active tab name here}& ".xls"
         ActiveWorkbook.SaveAs Filename:=sCopyName, FileFormat:=xlOpenXMLWorkbook
End Sub

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 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 2 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