1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| Private Sub CommandButton1_Click()
ListBox1.Clear
Dim fs
Set fs = Application.FileSearch
B = UserForm1.TextBox1.Text
z = ComboBox1.Text
If TextBox1.Text = "" Then
MsgBox "Veuillez saisir vos critéres de recherche"
Else
With fs
.LookIn = ThisWorkbook.Path & "\" & z & "\"
.SearchSubFolders = True
.filename = B
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
ListBox1.AddItem .FoundFiles(i)
Next i
Else: MsgBox "Aucuns Fichiers Trouvés, veuillez saisir vos critéres de recherche "
End If
End With
End If
End Sub |
Partager