Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm trying to add a series of labels to a userform at runtime. I'm
stuck on a couple of aspects. 1. It looks like each label needs a unique name (true??). I'm not able to do this. 2. When I set up each label, I need to assign it various properties. Some of these are easy (e.g. height, width, etc.). But others don't seem to be legal options (e.g. TextAlign) Here is my non-working code: 'Generate Table of each problem attempted Dim i As Integer Dim newLbl As MSForms.Control Dim lblName, strProb, strResult As String For i = 1 To 1 'numAttempts 'Label for Question Number lblName = "Forms.Label.Q" '& Right(i * 1000, 3) & ".1" Set newLbl = Me.Controls.Add(lblName) 'Run-time error - Invalid Class String newLbl.Caption = Range("results").Offset(i - 1, 0).Value With newLbl .Left = 54 .Top = 198 .Visible = True .Height = 12 .Width = 24 .TextAlign = 'Not legal here??? How do I do this? End With Next i Can anyone help? Thanks! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
add data labels in charts with tools (dynamically) | Charts and Charting in Excel | |||
dynamically create userform | Excel Programming | |||
How to create labels in a UserForm dynamically and be able to resize them with the mouse. | Excel Programming | |||
Referencing labels dynamically. | Excel Programming | |||
Dynamically Adding Code to Buttons on an existing UserForm | Excel Programming |