1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| Private Sub PurgeFic()
Dim CptFic As Integer
Dim CptRech As Integer
For CptRech = 1 To 2
' Boucle sur les fichiers pour
' les CATT : Y_O_LANCECATT*.TXT
' les eCATT : VAR_ECTC_Y_O_LANCECATT*.TXT
'===========================================
' Recherche des résultats des tests
'
With Application.FileSearch
.NewSearch
.LookIn = "C:\Users\JD002870\AppData\Local\SapWorkDir"
'.LookIn = "C:\Donnees\SAPworkdir\"
.SearchSubFolders = False
If CptRech = 1 Then
.Filename = "Y_O_LANCECATT*.TXT"
Else
.Filename = "VAR_ECTC_Y_O_LANCECATT*.TXT"
End If
.MatchTextExactly = True
.FileType = msoFileTypeAllFiles
End With
'===========================================
' Parcours des fichiers
'
With Application.FileSearch
If .Execute() > 0 Then
For CptFic = 1 To .FoundFiles.Count
fs.DeleteFile (.FoundFiles(CptFic))
Next CptFic
End If
End With
Next
'===========================================
' Rétablissement des valeurs par défaut
'
With Application.FileSearch
.NewSearch
.LookIn = "C:\My Documents"
.SearchSubFolders = True
.Filename = "Run"
.MatchTextExactly = True
.FileType = msoFileTypeAllFiles
End With
Sheets(2).Activate
Application.ScreenUpdating = False
End Sub |
Partager