Tester si un élément est dans paramArray
Bonjour
J'ai une fonction à arguments variables dont la structure est la suivante
Code:
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 |
où Belongs est une fonction qui teste l'appartenance à un tableau, le code est (reprenez-le si nécessaire)
Code:
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 |
Le problème est que j'ai l'erreur "utilisation incorrecte de ParamArray" quand j'appelle ma fonction comme ceci :
Quelqu'un saurait-il m'expliquer pourquoi ?
Merci d'avance