Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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
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
worksheet label in a cell Gecko Excel Discussion (Misc queries) 4 October 8th 09 05:36 PM
insert label in worksheet sune Excel Programming 5 November 17th 08 12:51 AM
Formula to lookup worksheet label Grotejm Excel Worksheet Functions 3 April 3rd 08 05:16 AM
Programmatically create a label in a worksheet. [email protected] Excel Programming 5 April 1st 08 03:53 PM
How to take the worksheet name as a variable(Label/Define) in a fo Subin Excel Worksheet Functions 2 March 14th 06 12:43 PM


All times are GMT +1. The time now is 03:51 PM.

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"