Author Topic: LSP Member Equivalent in VBA?  (Read 1421 times)

0 Members and 1 Guest are viewing this topic.

Guest

  • Guest
LSP Member Equivalent in VBA?
« 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.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: LSP Member Equivalent in VBA?
« Reply #1 on: October 23, 2007, 12:36:35 PM »
You can replicate functionality, depending on particular use / need, using collections or dictionaries.
Engineering Technologist CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com http://cadanalyst.slack.com http://linkedin.com/in/cadanalyst

Fatty

  • Guest
Re: LSP Member Equivalent in VBA?
« Reply #2 on: October 23, 2007, 12:45:17 PM »
Try this one

Code: [Select]
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'~

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: LSP Member Equivalent in VBA?
« Reply #3 on: October 23, 2007, 12:46:56 PM »
Variants, akkkk, my eyes!!

(sorry Fatty, not an advocate of variants)
Engineering Technologist CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com http://cadanalyst.slack.com http://linkedin.com/in/cadanalyst

Fatty

  • Guest
Re: LSP Member Equivalent in VBA?
« Reply #4 on: October 23, 2007, 01:13:57 PM »
Variants, akkkk, my eyes!!

(sorry Fatty, not an advocate of variants)
I don't like 'em too but what can I do?
Cheers :)

~'J'~

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: LSP Member Equivalent in VBA?
« Reply #5 on: October 29, 2007, 07:46:40 AM »
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.
Engineering Technologist CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com http://cadanalyst.slack.com http://linkedin.com/in/cadanalyst

Fatty

  • Guest
Re: LSP Member Equivalent in VBA?
« Reply #6 on: October 29, 2007, 07:56:59 AM »
Ah, I see
Sorry, my bad
In this case I have not have an answer :(

~'J'~

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: LSP Member Equivalent in VBA?
« Reply #7 on: October 29, 2007, 09:03:39 AM »
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.
Engineering Technologist CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com http://cadanalyst.slack.com http://linkedin.com/in/cadanalyst

Fatty

  • Guest
Re: LSP Member Equivalent in VBA?
« Reply #8 on: October 29, 2007, 09:20:20 AM »
Thanks Michael,
I guess he is busy with own job

Regards,

Oleg

~'J'~