loop through class module

K

KenCowen

I have class module (Reqs) with 9 variables declared as

Public Class_01 As String
Public Class_02 As String
Public Class_03 As String
etc

I want to build a string referencing those variables, during the
initialization of a userform, in loop like

for i=1 to 9

x(i)=Reqs(emp).Class_01

next i

using something like "Reqs(emp).Class_0" & i

but I can't figure out how to make it treat the concatenated string as
a property of the class, not a string.

Can someone point me in the right direction on this?

Thanks

Ken



where I build the
 
A

AB

Have you thought of having the 9 strings in a collection (still within
your class) variable instead?
Then:
- each item in the collection would be the string
- the key for each item would be the variable's name
and then you could call each variable by its name from the colelction
using the collection and your construct of "Class_0" & i
?
 
K

KenCowen

I thought about that right I after I posted. I think that will be a
better solution.
Thanks
Ken
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top