LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Object class in Excel VBA Tom Chau Excel Discussion (Misc queries) 1 June 29th 06 11:29 AM
How I can determine a base class of a procedure's incoming parameter? Dmitry V. Petkun Excel Programming 1 November 12th 03 01:41 PM
Class and object persistence James Neumann[_2_] Excel Programming 0 September 9th 03 03:48 PM
Problem Using an Object Variable in a Class Definition Boxman Excel Programming 2 August 28th 03 03:05 AM


All times are GMT +1. The time now is 03:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"