Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Return ActiveX properties by means of a variable???

Hi
I'm a hopeless beginner and have the following problem:

I'm trying to return properties of optionbuttons which are on a Excel
Worksheet by adressing them with varibles.
The Optionbuttons are Named "OptionButton1" etc.

This doesn't work:

ButtonCounter = 1
Do While ButtonCounter < 300
MyButton = "OptionButton" & ButtonCounter
If Sheets(3).MyButton.GroupName = ItemNo Then
Do something
End if
ButtonCounter = ButtonCounter + 3
Loop


I tried any syntax I could think of.

Can anybody tell me how I can return properties of an optionbutton
adressing it by means of an int variable
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Return ActiveX properties by means of a variable???

Sub SetOption()
Dim obj As OLEObject
Dim oBtn As MSforms.OptionButton
For Each obj In Worksheets(3).OLEObjects
If TypeOf obj.Object Is MSforms.OptionButton Then
Set oBtn = obj.Object
If LCase(oBtn.GroupName) = "itemno" Then
oBtn.Value = False
End If
End If
Next

End Sub

--
Regards,
Tom Ogilvy


true-blue wrote in message
om...
Hi
I'm a hopeless beginner and have the following problem:

I'm trying to return properties of optionbuttons which are on a Excel
Worksheet by adressing them with varibles.
The Optionbuttons are Named "OptionButton1" etc.

This doesn't work:

ButtonCounter = 1
Do While ButtonCounter < 300
MyButton = "OptionButton" & ButtonCounter
If Sheets(3).MyButton.GroupName = ItemNo Then
Do something
End if
ButtonCounter = ButtonCounter + 3
Loop


I tried any syntax I could think of.

Can anybody tell me how I can return properties of an optionbutton
adressing it by means of an int variable



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Return ActiveX properties by means of a variable???

Thanx a lot Tom, that did the job!
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
Definitions for Activex control properties? Blue Max Excel Worksheet Functions 2 December 17th 08 01:15 AM
Return a value if variable is in a range plally Excel Discussion (Misc queries) 3 October 23rd 08 08:27 PM
Return a Variable value length Sean Excel Worksheet Functions 5 December 4th 06 09:25 PM
How do I change activex control properties from a macro Billums Excel Discussion (Misc queries) 2 January 19th 06 01:21 PM
ActiveX Chart Properties in Excel 2000 Peter Huang [MSFT] Excel Programming 0 September 26th 03 08:29 AM


All times are GMT +1. The time now is 10:05 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"