j essaie de créer un macro qui trouve le chemin d'un répertoire et aussi avec un décompte(objective secondaire). pour l instant j'ai un bloque sur oFld qui m indique qui est vide et la erreur 70 arrive.

c'est mon premier post ici...



Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
45
46
47
Private Sub CommandButton2_Click()
 
Dim toto As String
 
MsgBox ababa("C:\", 0) & " repertoire total"
 
End Sub
 
 
Function ababa(stRep1 As String, deco As Integer) As String
 
Dim stRep 'Nom du répertoire à parcourir
Dim oFSO, oFld
Set oFSO = CreateObject("Scripting.FileSystemObject")
stRep = stRep1
 
If oFSO.FolderExists(stRep) Then
 
 If Not IsNull(oFld) Then
 
    For Each oFld In oFSO.GetFolder(stRep).SubFolders
 
        If Right(oFld.Name, (Len(oFld) - Len(stRep))) = "amd64" Then
            MsgBox oFld
        End If
 
        deco = deco + 1
 
        Label1.Caption = deco
 
        stRep1 = oFld
 
        Call ababa(stRep1, deco)
 
        If Right(oFld, (Len(oFld) - Len(stRep))) = "i386" Then
            MsgBox oFld
        End If
        'MsgBox deco & " / " & Right(oFld, (Len(oFld) - Len(stRep)))
 
    Next
 
    End If
 
End If
 
ababa = deco
End Function