Bonjour à tous
J'ai un soucis pour afficher des photos. Lorsque je clique dans ma Listbox3, j'affiche une valeur dans ma listbox4. Cette valeur (exemple " 21300") correspond à une image qui doit s'afficher, le problème est que je n'arrive pas à faire fonctionner le chemin.
Voici mon code :
Private Sub ListBox3_Click()
Dim Photo As String
Dim Cell As Range
Dim Tableau()
Dim x As Byte, z As Byte
ListBox4.Clear
Set Unique = New Collection
i = Feuil3.Range("a65536").End(xlUp).Row
For Each Cell In Feuil3.Range("a2:a" & i)
If Cell = ComboBox1 And Cell.Offset(0, 1) = ListBox3.Column(0) Then
On Error Resume Next
Unique.Add Cell.Offset(0, 4), CStr(Cell.Offset(0, 4))
On Error GoTo 0
End If
Next Cell
For Each Valeur In Unique
UserForm3.ListBox4.AddItem Valeur
Next Valeur
On Error GoTo Fin
Photo = ListBox4
Image1.Picture = LoadPicture(ActiveWorkbook.Path & "\Photo\Briquet\" & Photo & ".jpg")
Exit Sub
Fin:
Image1.Picture = LoadPicture(ActiveWorkbook.Path & "\Photo\" & "Image defaut.jpg")
Err.Clear
End Sub
Merci pour votre aide
J'ai un soucis pour afficher des photos. Lorsque je clique dans ma Listbox3, j'affiche une valeur dans ma listbox4. Cette valeur (exemple " 21300") correspond à une image qui doit s'afficher, le problème est que je n'arrive pas à faire fonctionner le chemin.
Voici mon code :
Private Sub ListBox3_Click()
Dim Photo As String
Dim Cell As Range
Dim Tableau()
Dim x As Byte, z As Byte
ListBox4.Clear
Set Unique = New Collection
i = Feuil3.Range("a65536").End(xlUp).Row
For Each Cell In Feuil3.Range("a2:a" & i)
If Cell = ComboBox1 And Cell.Offset(0, 1) = ListBox3.Column(0) Then
On Error Resume Next
Unique.Add Cell.Offset(0, 4), CStr(Cell.Offset(0, 4))
On Error GoTo 0
End If
Next Cell
For Each Valeur In Unique
UserForm3.ListBox4.AddItem Valeur
Next Valeur
On Error GoTo Fin
Photo = ListBox4
Image1.Picture = LoadPicture(ActiveWorkbook.Path & "\Photo\Briquet\" & Photo & ".jpg")
Exit Sub
Fin:
Image1.Picture = LoadPicture(ActiveWorkbook.Path & "\Photo\" & "Image defaut.jpg")
Err.Clear
End Sub
Merci pour votre aide