XL 2010 Problème de sélection dans ComboBox

Toubabou

XLDnaute Impliqué
Dans la CombBox de mon fichier se trouve des noms de champignons qui une fois sélectionnés doivent ouvrir Image1.
J'ai plusieurs photos d'un même champignon, donc à leurs noms j'ai rajouté un numéro d'ordre.
Bien évidement cela ne fonctionne pas. Auriez--vous une idée pour régler le problème?

VB:
Option Explicit

Private Sub ComboBox1_Change()
'''''''''POUR RENDRE "IMAGE1"? INVISIBLE''''''''''
Image1.Visible = True
''''''''''''''''''''''''''''''''''''''''''''''''''
If ComboBox1 = "" Then Image1.Picture = LoadPicture(""): Exit Sub
Image1.Picture = LoadPicture(ThisWorkbook.Path & "\" & IIf(ComboBox1.ListIndex = -1, "inexistante", ComboBox1) & ".jpg")
End Sub


Private Sub Image1_BeforeDragOver(ByVal Cancel As MSForms.ReturnBoolean, ByVal Data As MSForms.DataObject, ByVal X As Single, ByVal Y As Single, ByVal DragState As MSForms.fmDragState, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer)

End Sub

Private Sub UserForm_Initialize()
'''''''''POUR RENDRE "IMAGE1"? INVISIBLE''''''''''
Image1.Visible = False
''''''''''''''''''''''''''''''''''''''''''''''''''
Dim fichier
fichier = Dir(ThisWorkbook.Path & "\*.jpg")
While fichier <> ""
  If fichier <> "inexistante.jpg" Then ComboBox1.AddItem Left(fichier, Len(fichier) - 4)
  fichier = Dir
Wend
End Sub

Merci par avance,
Jean-Marie
 

Discussions similaires

Réponses
12
Affichages
441
Réponses
1
Affichages
296
Compte Supprimé 979
C
Réponses
18
Affichages
3 K

Statistiques des forums

Discussions
312 198
Messages
2 086 107
Membres
103 120
dernier inscrit
83400ren