1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If ThisWorkbook.Saved = False Then
ActiveWorkbook.Save 'enregistre le fichier sous le mon d'origine
' Enregitrement de sauvegarde dans un sous dodssier
nom = Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4) & "_" & Format(Date, "yyyy-mm-dd") & "_" & Format(Time, "hhmmss") & ".xls"
ActiveWorkbook.SaveCopyAs ActiveWorkbook.Path & "\sav\" & nom
' rep = MsgBox("Fichier sauvegardée sous le nom : " & nom, vbYes + vbInformation, "Worksheet Backup Copy")
Else
End If
End Sub |
Partager