Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loop through your own class? 1

Status
Not open for further replies.

iamareplicant

Programmer
Aug 7, 2004
50
0
0
US
Experts,

I need to be able to loop thru a class that i have created and match the class's property to a value in my Access db (dont ask why i am doing this - it would too long a post).

Is is possible to loop thru a self-defined class?

Something like:
Code:
...dim prop as SomethingProperty
...dim MyClass as SelfDefinedClass

for each prop in MyClass

debug.print prop.name(?)

next

Weird? Yes.

But can it be done, and if so, how?

TIA,

JBG
 
'Set Project Reference to "TypeLib Information"
Code:
Dim IInfo   As InterfaceInfo
Dim MInfo   As MemberInfo
Dim MyClass As Class1

Set MyClass = New Class1

Set IInfo = TLI.InterfaceInfoFromObject(MyClass)

For Each MInfo In IInfo.Members
    If MInfo.InvokeKind = INVOKE_PROPERTYGET Then Debug.Print MInfo
Next
 
Oh, to get the property Get return value you can use:

Debug.? CallByName(Class1,MInfo.Name,VbGet)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top