TheSwamp
Code Red => VB(A) => Topic started by: Guest on October 23, 2007, 12:24:03 PM
-
Is there an equivalent to LSPs MEMBER function in VBA? I thought I saw something (either a built-in function or a separate function) but I can't remember where or what it's called. I also have this funny feeling that I've posted this before (either here or another NG). :|
Thanks.
-
You can replicate functionality, depending on particular use / need, using collections or dictionaries.
-
Try this one
Option Explicit
Function IsMember(source As Variant, itm As Variant) As Boolean
Dim idx As Variant
On Error GoTo Err_Control
For Each idx In source
If (idx <> itm) Then
IsMember = False
Else
IsMember = True
Exit For
End If
Next
Exit Function
Err_Control:
IsMember = False
End Function
~'J'~
-
Variants, akkkk, my eyes!!
(sorry Fatty, not an advocate of variants)
-
Variants, akkkk, my eyes!!
(sorry Fatty, not an advocate of variants)
I don't like 'em too but what can I do?
Cheers :)
~'J'~
-
If this code isn't going to reside in a dll AND/Or directly exchange with LISP I don't understand why you use variants when explicit typing should prevail. Am I missing something?
In other words, as I understood the question, "What is the equivalent VB technique to mimic LISP's member function?", not "How do I pass a list to VB and have it perform a member type query?".
Could be me, surviving on crumbs of sleep.
-
Ah, I see
Sorry, my bad
In this case I have not have an answer :(
~'J'~
-
No worries my friend. Like I said, there's a good chance I'm misunderstanding the intent so perhaps it's best to wait and see if the original poster clarifies.
-
Thanks Michael,
I guess he is busy with own job
Regards,
Oleg
~'J'~