La macro a quelques erreurs: exemple chemin?, & ".pdf" (il y est déjà dans fichier)
Bref
un fichier est TOUJOURS le bienvenu...
Pour mettre du code utilise </> dans la barre du haut...
Dim rep1 As String, variable As String, variable1 As String, Fichier, listing As Byte
rep1 = rep1 = "T:\test\"
Fichier = Dir(rep1)
listing = 1
Do While Fichier <> ""
variable = Right(Fichier, 20)
variable1 = Left(variable, 10)
On Error GoTo gesterr
variable = DateSerial(Left(variable1, 4), Mid(variable1, 6, 2), Right(variable1, 2))
listing = listing + 1
If CDate(variable) < (Date - 8) Then 'Test la date du nom de fichier est plus vieille que 8 jours
Kill rep1 & Fichier 'Supprime le fichier
End If
Fichier = Dir
Loop
Exit Sub
gesterr:
MsgBox ("erreur")
On Error GoTo 0
A+ François