convert string to object/method. see example

thydzik

Registered User.
Local time
Today, 22:06
Joined
Jun 17, 2006
Messages
27
I was wondering if there was some way of achieving this.

Lets say I have 12 checkboxes named 'checkbox1' ..'checkbox12'

I want to assign their value to an array say 'arr(1 to 12)'
in stead of writing code for each one and assigning it to an array index, can I somehow do this:

for i = 1 to 12
arr(i) = somefunction("checkbox"+Cstr(i))
Next i

where somefunction is the function that converts the string to code

thanks
 
If you do it within the same form

Me.Controls("checkbox"+Cstr(i))

Will do what you are looking for ....
 
thanks for the reply. will try that out.
 
i tried this, but realised you said it will only work on forms.

the actual problem I have is the checkboxes are on an excel sheet, is there any thing that would work for this case?
 

Users who are viewing this thread

Back
Top Bottom