thanks bob:
what i am trying to do is create a form containing a list of names with a
checkbox next to each so a user can select which names to remove from the list.
the list is contained on a separate sheet and won't always have the same number
of names.
i was able to create the from using your examples. now i need to figure which
name is selected, but since the form is created on the fly, i'm not sure what
the name of each textbox or checkbox is.
is there a better way?
--
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