Private Sub Workbook_BeforeClose(Cancel As Boolean)
' je met a jour la base de données
ENVOIversHISTO
' je copie la date pour controler le lendemain
Range("A2").Select
Selection.Copy
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
' je sauvegarde
Application.DisplayAlerts = False
ActiveWorkbook.Save
' en fermant je sauvegarde pour celine a la date du jour
Dim Chemin As String
Chemin = "R:\DEPARTEMENT\"
ActiveWorkbook.SaveAs Filename:= _
Chemin & "Anomalies - " & Format(Date, "yyyy mm dd") & " .xls", FileFormat:=xlExcel8, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
Application.DisplayAlerts = True
End Sub