I have a workbook and been trying to figure out how to do backup automatically.. Think i'm about to pull out some hair. I found some code on internet and put them together It does do a back up, but when I change the date on my system clock to test it again. nothing. I'm thinking because it sees that format still n my directory even though the date is different. not sure, truth I'm a newb and been trying work through this and learn same time. My final backup idea is, when the book opens check daily backup directory and if file there and check month directory is there a current month there skip if not create one. and same with year. I been searching ways to kill the fills after 30 days(daily), 12(monthly) and 7(years). I still having figured out the function work with it. I found code that I been playing with, but not sure how to run it to see if it even works. lol I'm a mess that's for sure.
This is what I have.
Private Sub Workbook_Open()
Worksheets("Home Menu").Activate
Application.DisplayAlerts = False
Dim sFile As String
sFile = "Daily " & Format(Now(), "m-d-yyyy") & ".xlsm"
If Dir("C:\Backup_L\Daily\") & sFile & Format(Now(), "m-d-yyyy.xlsm") <> "" Then
MsgBox "its there" 'here just to test, will be taken out
Else
ActiveWorkbook.SaveCopyAs Filename:="C:\Backup_L\Daily\" & sFile & ".xlsm"
End If
Application.DisplayAlerts = True
End Sub
not sure how put it in one of those boxes in the forms. Sorry
The function I think I deleted and went on a search for another. any help would be apperceive
This is what I have.
Private Sub Workbook_Open()
Worksheets("Home Menu").Activate
Application.DisplayAlerts = False
Dim sFile As String
sFile = "Daily " & Format(Now(), "m-d-yyyy") & ".xlsm"
If Dir("C:\Backup_L\Daily\") & sFile & Format(Now(), "m-d-yyyy.xlsm") <> "" Then
MsgBox "its there" 'here just to test, will be taken out
Else
ActiveWorkbook.SaveCopyAs Filename:="C:\Backup_L\Daily\" & sFile & ".xlsm"
End If
Application.DisplayAlerts = True
End Sub
not sure how put it in one of those boxes in the forms. Sorry
The function I think I deleted and went on a search for another. any help would be apperceive