Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Iterating through each label on a worksheet
I need to write something that will iterate through all of the labels on my worksheet and change some of their properties. Specifically, I need to update the height and width, the background and foreground colors, and add a border. I tried this, which was successful for the height and width, but there seem to be no options for the other properties. Can anyone help? Thanks.
Sub updateLabels() Dim obj As OLEObject Dim lblwidth, lblHeight as Single lblWidth = 488.25 lblHeight = 26.25 For Each obj In Sheet2.OLEObjects If obj.progID = "Forms.Label.1" Then obj.Height = lblHeight obj.Width = lblWidth obj.Backcolor 'doesn't exist obj.Forecolor 'doesn't exist obj.Border 'doesn't exist End If Next obj End Sub By the way, I don't really care if these labels are ActiveX labels or just regular old labels. I just did ActiveX since I couldn't find a way to iterate through regular labels. If you have a solution that works for normal labels, please reply. Thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
worksheet label in a cell | Excel Discussion (Misc queries) | |||
insert label in worksheet | Excel Programming | |||
Formula to lookup worksheet label | Excel Worksheet Functions | |||
Programmatically create a label in a worksheet. | Excel Programming | |||
How to take the worksheet name as a variable(Label/Define) in a fo | Excel Worksheet Functions |