Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ron Ron is offline
external usenet poster
 
Posts: 250
Default Add a label at runtime

Hi,

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


Regards,
Ron.
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ian Ian is offline
external usenet poster
 
Posts: 238
Default 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" wrote in message
...
Hi,

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


Regards,
Ron.



  #3   Report Post  
Posted to microsoft.public.excel.programming
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.





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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" wrote in message
...
Hi,

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


Regards,
Ron.



Reply
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
Changing the font for part of an axis label, not the whole label. amy45 Charts and Charting in Excel 2 April 5th 23 01:11 PM
How to rezize data label box in pie charts (label wraps to two lin rolliedogg Charts and Charting in Excel 1 October 18th 06 08:17 PM
COPY LABEL FORM FROM EXCEL TO A LABEL xrayAndi New Users to Excel 1 March 5th 06 02:21 PM
how to remove label formatting (eg label to number) sikkiekaka Excel Worksheet Functions 0 November 4th 04 11:35 PM
add text to label (label from forms toolbar) Rob Bovey Excel Programming 0 September 5th 03 09:46 PM


All times are GMT +1. The time now is 08:19 AM.

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

About Us

"It's about Microsoft Excel"