LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default userform label creation

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









 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Userform Label Steve[_9_] Excel Discussion (Misc queries) 7 October 29th 07 09:51 PM
Flashing UserForm Label grahammal[_25_] Excel Programming 1 March 27th 06 03:20 PM
Userform blinking label Ed Excel Programming 2 July 17th 04 12:24 AM
UserForm label doesn't load? Ed[_18_] Excel Programming 4 June 21st 04 07:53 PM
Conditional Checkbox Creation on a UserForm Todd Huttenstine[_2_] Excel Programming 1 November 21st 03 03:38 PM


All times are GMT +1. The time now is 07:46 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"