Bonjour tout le monde !
Voilà, mon programme bloque sur la fonction UBound appliquée à un tableau "FichChoisis" rempli de la manière suivante :

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
Private Sub CommandButton1_Click()
    Dim i As Integer, n As Integer
    Dim FichChoisis() As String 
    'Rentrée des éléments sélectionnés dans la ListBox (des noms de fichiers) dans le tableau FichChoisis
    ReDim FichChoisis(0)
    n = 0
    For i = 0 To ListBox1.ListCount - 1
        If ListBox1.Selected(i) Then
        ReDim Preserve FichChoisis(n)
        FichChoisis(n) = ListBox1.List(i)
        MsgBox FichChoisis(n)  'vérifie que le tableau enregistre les bonnes données
        n = n + 1
        End If
    Next i
    MsgBox UBound(FichChoisis)  
    UserForm3.Hide   
End Sub
Dans ce code la ligne "MsgBox UBound(FichChoisis)" fonctionne et renvoie le bon chiffre; mais lorsque j'utilise UBound(FichChoisis) là où j'en ai besoin ça génère une erreur ("L'indice n'appartient pas à la selection"...).

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
Public FichChoisis() As String
Sub Super_Min_Max()
    Dim i As Integer
    For i = 0 To UBound(FichChoisis)
    'instructions....
    Next i
End Sub
Je ne comprend pas pourquoi... Si quelqu'un pouvait m'éclairer...

PS: J'ai également essayer UBound(FichChoisis, 1); ça donne la même chose.