Public nb As Long
Sub Bouton1_Cliquer()
Dim chemin As String
nb = 0
chemin = "N:\Bibliotheque\Modèles\500-599 Prod&Meth"
Lister chemin
End Sub
Public Function Lister(chemin As String)
Dim fs, fl, Rep, f As Variant, NewRep As String, Nomfich As String
Set fs = CreateObject("Scripting.FileSystemObject")
Lister = fs.GetFolder(chemin).Files.Count
Nomfich = Dir(chemin & "\*.*")
fl = fs.GetFile(Lister & Nomfich)
Do While Nomfich <> ""
nb = nb + 1
Cells(nb, 1) = Nomfich 'liste dans la feuille de calculs active
Cells(nb, 2).Hyperlinks.Add Cells(nb, 2), chemin & "\" & Nomfich
'Cells(nb, 3) =
'Cells(nb, 4) =
Nomfich = Dir()
Loop
'Pour chaque sous-répertoire, appel récursif de Lister
For Each Rep In fs.GetFolder(chemin).SubFolders
NewRep = Lister(Rep.Path)
Next Rep
End Function