Hi all,
Currently using the following code to backup a workbook when it is opened
Currently, the backup is dropped in the same location as the main document. I've created a backup folder in the same location to which I wish to save backups - keep things a little tidier
However, I'm not sure what I should be changing with the above code. I've tried
but no dice. I imagine it's something simple I'm missing, that's usually the way with VBA I find.
Any advice?
Thanks!
Currently using the following code to backup a workbook when it is opened
VBA Code:
Dim sFileName As String
Dim sDateTime As String
With ThisWorkbook
sDateTime = " Backup Created (" & Format(Now, "dd-mm-yyyy hhnnss") & ").xlsm"
sFileName = Application.WorksheetFunction.Substitute _
(.FullName, ".xlsm", sDateTime)
.SaveCopyAs sFileName
End With
Currently, the backup is dropped in the same location as the main document. I've created a backup folder in the same location to which I wish to save backups - keep things a little tidier
However, I'm not sure what I should be changing with the above code. I've tried
VBA Code:
.SaveCopyAs "[pathway]" & sFileName
Any advice?
Thanks!