View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jeremy Jeremy is offline
external usenet poster
 
Posts: 14
Default Using a string to set an object reference?

Hi,

This is hard to explain. Let me describe the situation:

Suppose I have a set of custom classes clsAbstract, cls1, cls2, and
cls3, where the last three classes implement clsAbstract, and then a
custom collection that only takes objects of type clsAbstract.

On a worksheet, in the Activate event, I set a global variable that
stores the locations of some "anchor" ranges which form the top left
corner of the areas containing information that cls1, cls2, and cls3
are going to need. The locations are stored as a string so I can use
Split to get the addresses. I know that cls1 will always be anchored
at the first address in the array, cls2 at the second, etc.

Now, what would be nice is if I could pass the "anchor" address to the
collection and let it decide which object it's going to use. I thought
that maybe I could have it looking at a table in another worksheet or
something, where you have, say:

A32 cls1
A56 cls2
A100 cls3

and then it uses the text in column 2 and sets the object reference to
a new object of type (whatever it looked up). Can I do this? I've
searched around a lot, but I can't figure out what to search for, much
less whether this is possible.