Bonjour à tous,

Je sèche sur le controle treeview que j'utilise pour la première fois.
Ci-après une procédure que j'ai écrite et qui fonctionnait parfaitement jusqu'à aujourd'hui.

Je subis une erreur 13 (incompatibilité de type) sur le 4e ligne :


La procédure entière :

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
 
Dim tw As MSComctlLib.TreeView
 
Private Sub UserForm_Initialize()
 
 
Dim i As Byte, J As Byte, s As String, F As Byte, G As Byte
 
 
Set tw = Me.TreeView2
 
tw.Nodes.Clear
 
With tw
    'Noeud parent
    .Nodes.Add , , "Niveau 1", "Mixed pallet recev. with RF, put away in bulk"
    Set ObjNoeud = .Nodes("Niveau 1")
    ObjNoeud.Bold = True
 
 
    For i = 1 To 13 ' Noeud enfant niveau 1
        .Nodes.Add "Niveau 1", tvwChild, "Niveau 1" & i, Worksheets("OPSEQUENCES").Cells(254 + i, 4)
    Next i
 
    For F = 1 To 8
    Set ObjNoeud = .Nodes.Add("Niveau 12", tvwChild, "Niveau 12" & F, Worksheets("OPTASK").Cells(220 + F, 6))
    ObjNoeud.ForeColor = &HB08050
    Next F
 
End With
 
For i = 1 To TreeView1.Nodes.Count
    TreeView1.Nodes.Item(i).Expanded = True
Next
 
Set ObjNoeud = Nothing
 
End Sub
Avez-vous une idée ?

Merci d'avance,
Laurent