View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default MSForm 2 - Creating labels and text boxes at run time

No, here is an example

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 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


--

HTH

RP

"Tim Coddington" wrote in message
...
Is CreateObject used to place a new label or text box onto a form at run
time? All I could find in the examples is how to create applications or
workbooks:
Set xlApp = CreateObject("Excel.Application")

Thanks in advance,
-Tim