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
| Public Function Repertoires_Like(Repertoires)
Dim Fso As Object
Dim t
Dim rep
Dim Reps()
Dim r
r = 0
Dim I
ReDim Reps(0)
If Right(Trim("" & Repertoires), 1) = "*" Then
t = Split(Repertoires & "\", "\")
For I = 0 To UBound(t)
If Right(Trim("" & t(I)), 1) = "*" Then Exit For
rep = rep & Trim("" & t(I)) & "\"
Next
Set Fso = CreateObject("Scripting.FileSystemObject")
If Fso.FolderExists(rep) = True Then
Set FSfolder = Fso.GetFolder(rep)
For Each subfolder In FSfolder.SubFolders
If InStr(1, UCase(Trim("" & subfolder.Name)), Left(UCase(Trim("" & t(I))), Len(UCase(Trim("" & t(I)))) - 1)) <> 0 Then
ReDim Preserve Reps(r)
Reps(r) = subfolder.Path
r = r + 1
End If
Next subfolder
End If
End If
Repertoires_Like = Reps
Set Fso = Nothing
End Function |