I have been playing with the following code. It works the first time, but then it appends another timestamp on the filename that already was timestamped before. I would like this to create a new filename in the same directory with format 2018 Test_YYYY.MM.DD_HHMM
with the timestamp updated each time. Bonus if i can figure out how to add the last user who modified the file!
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim sFileName As String
Dim sDateTime As String
With ThisWorkbook
sDateTime = " (" & Format(Now, "yyyy-mm-dd hhmm") & ").xlsm"
sFileName = Application.WorksheetFunction.Substitute _
(.FullName, ".xlsm", sDateTime)
.SaveCopyAs sFileName
End With
End Sub