Dim racine As String
Dim Dl1 As Long ' dernière ligne
public User_files as string
'-------------------------------------------------------------------
' Module : Module1/arborescence
' DateTime : 15/09/2008 / 13:05
' Auteur : JP14
' Utilisation :lire un repertoire et les fichiers
'--------------------------------------------------------------------
Sub arborescence()
Dim choixdossier$
Application.ScreenUpdating = False
' dossier à scanner
choixdossier = ChDossier
If choixdossier = "" Then Exit Sub
User_files = choixdossier
End Sub
Private Function ChDossier()
Dim objShell, objFolder, chemin, SecuriteSlash
Set objShell = CreateObject("Shell.Application")
Set objFolder = _
objShell.BrowseForFolder(&H0&, "Choisisser un répertoire", &H1&)
On Error Resume Next
chemin = objFolder.ParentFolder.ParseName(objFolder.Title).Path & ""
If objFolder.Title = "Bureau" Then
chemin = "C:\"
End If
If objFolder.Title = "" Then
chemin = ""
End If
SecuriteSlash = InStr(objFolder.Title, ":")
If SecuriteSlash > 0 Then
chemin = Mid(objFolder.Title, SecuriteSlash - 1, 2) & ""
End If
ChDossier = chemin
Sheets("Selection").Range("f9") = ChDossier
End Function