Hi,
Can anyone tell me how I can add a label to a form at runtime.
Regards,
Ron.
Hi,
Can anyone tell me how I can add a label to a form at runtime.
Regards,
Ron.
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" <Ron@discussions.microsoft.com> wrote in message
news:FBCE07A0-5039-4DD7-B7EC-1AE780BE99F6@microsoft.com...
> Hi,
>
> Can anyone tell me how I can add a label to a form at runtime.
>
>
> Regards,
> Ron.
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" <me@me.com> wrote in message
news:eJHkf.13622$w73.9496@newsfe1-gui.ntli.net...
> 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" <Ron@discussions.microsoft.com> wrote in message
> news:FBCE07A0-5039-4DD7-B7EC-1AE780BE99F6@microsoft.com...
> > Hi,
> >
> > Can anyone tell me how I can add a label to a form at runtime.
> >
> >
> > Regards,
> > Ron.
>
>
If by form, you mean a userform:
Private Sub UserForm_Initialize()
Dim LBL As MSForms.Label
Set LBL = Controls.Add("Forms.Label.1", "Lable2", True)
LBL.Top = 5
LBL.Left = 5
LBL.Caption = "abcd"
End Sub
--
Regards,
Tom Ogilvy
"Ron" <Ron@discussions.microsoft.com> wrote in message
news:FBCE07A0-5039-4DD7-B7EC-1AE780BE99F6@microsoft.com...
> Hi,
>
> Can anyone tell me how I can add a label to a form at runtime.
>
>
> Regards,
> Ron.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks