Gary,
you could create a control array, and after creating the checkboxes, check
it through the app event
Dim mcolEvents As Collection
Private Sub UserForm_Initialize()
Dim cBtnEvents As clsUserFormEvents
Dim ctl As msforms.Control
'create your controls here
Set mcolEvents = New Collection
For Each ctl In Me.Controls
If TypeName(ctl) = "CheckBox" Then
Set cChkEvents = New clsUserFormEvents
Set cChkEvents.mCBGroup = ctl
mcolEvents.Add cBtnEvents
End If
Next
End Sub
Add a Class (call it clsUserFormEvents) module
Option Explicit
Public WithEvents mCBGroup As msforms.CheckBox
Private Sub mCBGroup _Click()
MsgBox mCBGroup.Caption & " has been pressed"
End Sub
--
HTH
Bob Phillips
(replace somewhere in email address with gmail if mailing direct)
"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
figured out how to name and reference each textbox and checkbox, now i
just have
to parse the list of check boxes to see which names to delete.
had to use userform!textbox1 and so on
--
Gary
"Bob Phillips" wrote in message
...
Gary,
Here is some code to show how to add controls
Dim newButton As MSForms.Control
Select Case True
Case chkText.Value
Set newButton = Me.Controls.Add("Forms.Textbox.1")
newButton.Name = "New Textbox"
Case chkButton.Value
Set newButton = Me.Controls.Add("Forms.CommandButton.1")
newButton.Caption = "newCmd"
Case chkListbox.Value
Set newButton = Me.Controls.Add("Forms.Listbox.1")
newButton.Name = "lstTemp"
Case chkCheckbox.Value
Set newButton = Me.Controls.Add("Forms.Checkbox.1")
newButton.Caption = "Another Checkbox"
End Select
With newButton
.Left = 100
.Top = 50
.Visible = True
End With
but you still have to have some code behind the form to process the
control
and this is convoluted. Why not just create them at design time?
--
HTH
Bob Phillips
(replace somewhere in email address with gmail if mailing direct)
"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
myles:
i am just going to use a listbox. seems much easier
thanks
--
Gary
"Myles" wrote in
message
...
Gary,
Point of clarification. Do you want to add the labels to the Userform
created on the fly?
Myles
--
Myles
------------------------------------------------------------------------
Myles's Profile:
http://www.excelforum.com/member.php...o&userid=28746
View this thread:
http://www.excelforum.com/showthread...hreadid=569303