I setup this sub to have my file backed up every 5 minutes.
When I execute the module manually it works as expected but after the 5 minutes timeout I get an error message saying it cannot run [workbook path][sub name]
I looked at examples on the web and I can't find what I did wrong.
My sub is inside a module. Here is the code:
Any clue?
When I execute the module manually it works as expected but after the 5 minutes timeout I get an error message saying it cannot run [workbook path][sub name]
I looked at examples on the web and I can't find what I did wrong.
My sub is inside a module. Here is the code:
Code:
Public Sub SilentBackup()
If Not Left(ActiveWorkbook.Path, 8) = "https://" Then
strBackupPath = ActiveWorkbook.Path & "\Backups\" 'Nom du dossier local dans lequel mettre le backup
Else
Exit Sub
End If
strBackupFileName = Left(ThisWorkbook.Name, (InStrRev(ThisWorkbook.Name, ".", -1, vbTextCompare) - 1)) & "_backup_" & Format(Now(), "yyyy-mm-dd_hhmm") & ".xlsm"
ActiveWorkbook.SaveCopyAs strBackupPath & strBackupFileName
If Len(Dir(strBackupPath & strBackupFileName)) = 0 Then
Debug.Print Now & " : Tentarive de backup échouée"
Else
Range("dateDernierBackup").Value = Date
Debug.Print Now & " : Backup réussi: " & strBackupPath & strBackupFileName
End If
Application.OnTime EarliestTime:=Now + Range("SilentBackupDelai"), Procedure:="SilentBackup"
End Sub
Any clue?