par Michael DELIQUE » 02 Nov 2010 à 17:27
une variante permettant de savoir si un variant contient un array ou une liste exploitable
- Code : Tout sélectionner
Function TestArray(wvrValue As Variant) As Boolean
'Cette fonction permet de savoir si le variant contient un array ou une liste exploitable
'cad contenant au moins une occurence
'déclaration Variable
Dim i As Integer
On Error Goto ErreurHandle
TestArray = False
Select Case Datatype(wvrValue)
Case 0 To 11,13 To 17
Exit Function
Case Else
If Isempty(wvrValue) = False Then
If Isarray(wvrValue) Or Islist(wvrValue) Then
i = 0
Forall Value In wvrValue
i = i+1
If i > 2 Then
'pour eviter un traitement trop long s'il ya bcp de valeurs
Exit Forall
End If
End Forall
If i > 0 Then
TestArray = True
End If
End If
End If
End Select
Exit Function
ErreurHandle:
Msgbox "("+Cstr(Getthreadinfo (1))+" Call by "+Cstr(Getthreadinfo(10))+")"+Chr(10)+"Erreur " + Str(Err) + " : "+Chr(10) + Cstr(Error)+". "+Chr(10)+"Ligne N° "+Cstr(Erl),16," ERREUR !"
TestArray = False
Exit Function
End Function
Cordialement
Michael (SMS-Phobique)
----------------------------
"La théorie, c'est quand on sait tout et que rien ne fonctionne. La pratique, c'est quand tout fonctionne et que personne ne sait pourquoi."
Albert EINSTEIN