+ Reply to Thread
Results 1 to 4 of 4

Add a label at runtime

  1. #1
    Ron
    Guest

    Add a label at runtime

    Hi,

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


    Regards,
    Ron.

  2. #2
    Ian
    Guest

    Re: Add a label at runtime

    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.




  3. #3
    Bob Phillips
    Guest

    Re: 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" <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.

    >
    >




  4. #4
    Tom Ogilvy
    Guest

    Re: Add a label at runtime

    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.




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1