Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Determine the class of an object
I construct several classes and store them sequentually in a collection
as they are created. Each class is unique. To access a method of the class I need to cast back to the original class type. How can I determine the class type during runtime? See the following pseudo code. Dim myCollection as New Collection Dim myClass1 as Class1 Dim myClass2 as Class2 Set myClass1 = new Class1 myCollection.Add Item:=myClass1 Set myClass2 = new Class2 myCollection.Add Item:=myClass2 set myClass1 = new Class1 myCollection.Add Item:=myClass1 Later Dim nowClass1 as Class1 Dim nowClass2 as Class2 Set nowClass1 = myCollection.Item(1) ' Same class Set nowClass2 = myCollection.Item(1) ' Not the same class *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Object class in Excel VBA | Excel Discussion (Misc queries) | |||
How I can determine a base class of a procedure's incoming parameter? | Excel Programming | |||
Class and object persistence | Excel Programming | |||
Problem Using an Object Variable in a Class Definition | Excel Programming |