Setting the backcolor of a label created in VBA code

Pianoman23

New Member
Joined
May 16, 2014
Messages
25
Hello
I have a series of labels created using the following code:

t = 66
l = 87
Set lbl1 = Controls.Add("Forms.Label.1")
With lbl1
.Name = "label" & i
.Caption = "APRIL"
.Height = 12
.Width = 50
.Left = l
.Top = t
End With

Is it possible to set the backcolor of the created labels within the code? I've tried putting a dot and then looking at the dropdown list, but there's nothing in there that refers to color.

Can anyone help?
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Code:
.BackColor = RGB(150, 200, 200)
 
Upvote 0

Forum statistics

Threads
1,213,530
Messages
6,114,163
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top