LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default referencing commandbuttons as OLEObjects

Give this a try...

Sub test()
Dim ctl As OLEObject

For Each ctl In Sheet1.OLEObjects
MsgBox ctl.Object.BackColor
Next ctl
End Sub

Your code will work but it needs to refernece the object then the backcolor...
--
HTH...

Jim Thomlinson


"Bert" wrote:

I want to be able to manipulate and get information about a large number of
commandbuttons using something like:
x = Worksheets(2).OLEObjects.Count
For b = 1 To x
xx = Worksheets(2).OLEObjects.Item(b).BackColor
Next b
This generates a error. (Although xx =
Worksheets(2).OLEObjects.Item(b).Name does not)
The only objects in the OLEObjects collection are commandbuttons.
How can I make this work?
Thanks.



 
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
How to copy commandbuttons leonidas[_51_] Excel Programming 1 July 25th 06 03:06 PM
CommandButtons Mats Samson Excel Programming 4 January 17th 06 02:19 PM
Commandbuttons PCOR Excel Programming 1 May 11th 04 11:21 PM
Do While, OnTime and CommandButtons John Petty Excel Programming 1 November 23rd 03 12:23 AM
commandbuttons properties Rui[_2_] Excel Programming 2 November 5th 03 04:07 PM


All times are GMT +1. The time now is 05:14 PM.

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

About Us

"It's about Microsoft Excel"