at one stage I had something working in the
background to autosave a copy of a workbook every 10 minutes, renamed to something else. I think it was:
VBA Code:
Public dTime As Date
Sub AutoSaveAs()
dTime = Time + TimeValue("00:10:00") 'change this interval to your requirements
With Application
.OnTime dTime, "AutoSaveAs"
.EnableEvents = False
.DisplayAlerts = False
ThisWorkbook.SaveCopyAs "new name of your file" & ".xlsm"
.EnableEvents = True
End With
End Sub
not sure if it automatically copies over the saved file each time without user input.
Also I had another instance of saving a copy but naming it with same name plus a timestamp every 30 minutes or something. This would repeat for 5 loops and the sixth time it would save but delete the oldest file only ever keeping 5 latest copies of the file over the last 150 minutes.
VBA Code:
Public dTime As Date
Sub AutoSaveAs()
Dim fso As New FileSystemObject
Dim fil As File
Dim oldfile As File
Dim BackUpPath As String 'This is the FOLDER where backups are stored
dTime = Time + TimeValue("00:30:00")
With Application
.OnTime dTime, "AutoSaveAs"
.EnableEvents = False
.DisplayAlerts = False
ThisWorkbook.SaveCopyAs "C:/yourfolder/30 minute backups/yourfilename backup" & Format(Date, "yyyy.mm.dd") & ".h" _
& Hour(Now) & ".m" & Minute(Now) & ".xlsm" 'you have to create the folders where all this saves
.EnableEvents = True
End With
Do Until fso.GetFolder("C:/yourfolder/30 minute backups").Files.Count < 6
For Each fil In fso.GetFolder("C:/yourfolder/30 minute backups").Files
'Checks to see if this file is older than the oldest file thus far
If oldfile Is Nothing Then Set oldfile = fil
If oldfile.DateLastModified > fil.DateLastModified Then Set oldfile = fil
Next fil
fso.DeleteFile oldfile, True
Set oldfile = Nothing
Loop
End Sub
If you try this and it doesn't work there might be some extra Functions I have left out which I would have to add one at a time to see which one matters. I have stuff everywhere in that workbook and I'm not an expert. (unless you count copy/paste)