P
pombela
Guest
Bonjour, j'utilise un userform avec un bouton pour lister le contenu d'un répertoire dans une listbox. Cela fonctionne hormis le fait qu'il me manque systématiquement
1 fichier sur le nombre de fichiers contenu dans mon répertoire.
Voici le code de la listbox :
Private Sub ListBox1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
If mbDisableEvents Then Exit Sub
mbDisableEvents = True
With Me.ListBox1
If .ListCount > 0 Then
If .ListIndex = .ListCount - 1 Then
.ListIndex = .ListCount - 1
End If
End If
MsgBox "Vous avez sélectionné :" & .List(.ListIndex)
End With
mbDisableEvents = False
Comment résoudre le problème.
Merci
1 fichier sur le nombre de fichiers contenu dans mon répertoire.
Voici le code de la listbox :
Private Sub ListBox1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
If mbDisableEvents Then Exit Sub
mbDisableEvents = True
With Me.ListBox1
If .ListCount > 0 Then
If .ListIndex = .ListCount - 1 Then
.ListIndex = .ListCount - 1
End If
End If
MsgBox "Vous avez sélectionné :" & .List(.ListIndex)
End With
mbDisableEvents = False
Comment résoudre le problème.
Merci