Macro with Save Current date
excel, vba
Solution
Like this?
Sub Save()
Dim FilePath As String
Dim NewName As String
FilePath = "X:\": NewName = FilePath & "file" & Format(Date, "MM-DD-YYYY") & ".xlsm"
ActiveWorkbook.SaveAs Filename:=NewName, FileFormat _
:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
End Sub
Problem
Is there a way to make a macro to save a file with the current day in the name. I want to save this off everyday with the correct date. This is what I have as a macro, pretty simple, but I am having issues with getting the current date formula in the file name (if possible) ``` Sub Save() ActiveWorkbook.SaveAs Filename:="X:\file06-21-2012\.xlsm", FileFormat _ :=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False End Sub ``` So tomorrow i would want the marco to save it as file06-22-2012. Thanks