Control Arrays in VBA Project

J

Jim

I have some 30 checkboxes on a user form. Life would be much easier if a
control had the "Index" property as in VB. Is there something similar I can
use so I can loop through every checkbox and set and retrieve its value??

thanks.
 
J

Jan De Messemaeker

Hi Jim

I can run through the controls of a form :
Formname.Controls(Index)
Can't you?
 
J

Jim

Thanks I can do that. But then when I write

For i = 0 To SetupUserForm.Controls.Count - 1

Then how can i get the control's name property? SetupUserForm.Controls.Name
does not exist:

If TypeOf SetupUserForm.Controls(i) Is CheckBox Then
debug.print SetupUserForm.Controls(i).Name ' does not exist!

thanks
 
J

Jan De Messemaeker

SetupUserForm.Controls(i).Name
gives me no problem at all !
(the project it is in must be the active VB Project)
 

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