creating array of checkboxes on useform

R

red6000

Hi,

I use the following code to create an array of checkboxes on a userform:

Dim xArray()
Dim xCount As Integer
Dim xControl As Control

For Each xControl In EditFrm.Controls
If TypeOf xControl Is MSForms.CheckBox Then
ReDim Preserve xArray(xCount)
Set xArray(xCount) = xControl
xCount = xCount + 1
End If
Next xControl


How would I amend the code to create an array, but only for checkboxes
within a frame?

Thanks.
 
J

Jean-Guy Marcil

red6000 was telling us:
red6000 nous racontait que :
Hi,

I use the following code to create an array of checkboxes on a
userform:
Dim xArray()
Dim xCount As Integer
Dim xControl As Control

For Each xControl In EditFrm.Controls
If TypeOf xControl Is MSForms.CheckBox Then
ReDim Preserve xArray(xCount)
Set xArray(xCount) = xControl
xCount = xCount + 1
End If
Next xControl


How would I amend the code to create an array, but only for checkboxes
within a frame?

Change
If TypeOf xControl Is MSForms.CheckBox Then
for
For Each xControl In EditFrm.Frame1.Controls

using the approriate object instead of Frame1, Oeuf Corse.

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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