Wie stelle ich das an? Kann mir einer bitte eine Hilfestellung geben?
Vielen Dank
Gruß
Sub killen()
Dim strPath$, strFile$, strExt$, Darf%, Alter As Date
strPath = ActiveSheet.Range("B1").Value
If Right(strPath, 1) <> "\" Then strPath = strPath & "\"
strExt = "*.txt" 'Dateiextension ggf. anpassen
Darf = ActiveSheet.Range("A1").Value 'Alter in Tagen
If strPath = "" Then
Exit Sub
Else
strFile = Dir(strPath & strExt)
Do While Len(strFile) > 0
Alter = FileDateTime(strPath & strFile)
If Date - Alter > Darf Then
Kill strPath & strFile
End If
strFile = Dir() ' nächste Datei
Loop
End If
End Sub