Bonjour
J'ai une fonction à arguments variables dont la structure est la suivante
où Belongs est une fonction qui teste l'appartenance à un tableau, le code est (reprenez-le si nécessaire)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 Function mafonction(arg1 As Long, ParamArray tableau() As Variant) If UBound(etatsReporting) = -1 Or Belongs("toto", etatsReporting) Then 'des trucs end if end function
Le problème est que j'ai l'erreur "utilisation incorrecte de ParamArray" quand j'appelle ma fonction comme ceci :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 'Renvoie true si un element appartient à un tableau Function Belongs(Item, MyArray As Variant) As Boolean Dim Member Belongs = False If Not IsNull(MyArray) Then For Each Member In MyArray If Item = Member Then Belongs = True: Exit Function Next End If End Function
Quelqu'un saurait-il m'expliquer pourquoi ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part mafonction(0)
Merci d'avance
Partager