View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Add a label at runtime

Dim newCtl As msforms.Control
Set newCtl = Me.Controls.Add("Forms.Label.1")
newCtl.Caption = "New Label"

With newCtl
.Left = 100
.Top = 50
.Visible = True
End With

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Ian" wrote in message
...
I don't know if you can do this, but you could create a label beforehand
with a blank caption then use Label1.Caption = "Test label" at runtime to
populate it.

--
Ian
--
"Ron" wrote in message
...
Hi,

Can anyone tell me how I can add a label to a form at runtime.


Regards,
Ron.