Forum Discussion
Macro to 'save as' with a date in the file name
Hello Andrew Boles , Sorry it's taken 3 yrs for you to get a reply from someone. If you're still looking for an answer to you question try this code. It's not mine but made up of bits from all around the internet. Hope it helps.
Sub File_Saver()
' Some variables
Dim IntialName As String
Dim fileSaveName As Variant
'A catch to give a default name of what's in cell A1
InitialName = Range("A1")
'Automatic generation of month day, year file name, 4 m's will give the full month, 1 d will give 2 instead of 02 and yy will give you a 2 digit year. This includes spaces and a comma.
YourFile = Format(Date, "mmm") & " " & Format(Date, "dd") & ", " & Format(Date, "yyyy") & ".xlsx"
'File save dialog opener
fileSaveName = Application.GetSaveAsFilename(InitialFileName:=IntialName & " " & sFile, _
fileFilter:="Excel Files (*.xlsx), *.xlsx")
End Sub
fileSaveName = Application.GetSaveAsFilename(InitialFileName:=IntialName & " " & YourFile, _
fileFilter:="Excel Files (*.xlsx), *.xlsx")