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
| Private Sub CommandButton2_Click()
'Permet de fournir la liste des dossiers dans un dossier
Dim a As String, b As String, i As Integer
a = InputBox("Collez ici l'adresse du dossier considéré")
b = InputBox("Voulez vous le lien hypertexte", "Disponible uniquement sur PC", "NON")
If a = "" Then
Exit Sub
End If
i = 1
Dim fs, f, f1, s, sf
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(a)
Set sf = f.SubFolders
For Each f1 In sf
s = f1.Name
Sheets("Feuil1").Select
'Ecriture en dessous de la ligne 6
Cells(6 + i, 2).Select
Cells(6 + i, 2).Borders.Value = 1
Cells(6 + i, 1) = i
Cells(6 + i, 1).Borders.Value = 1
ActiveCell.FormulaR1C1 = s
'MsgBox (a & "\" & s)
If b = "oui" Then
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:=a & "\" & s, _
TextToDisplay:=s
End If
i = i + 1
Next
Exit Sub
End Sub |
Partager