Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Enabling Option Buttons - Control

Hi - I have two option buttons (controls) on a sheet - no frame round
them.

In a certain scenario I want the 2nd optionbutton to be disabled so
the user can not click in it.

This is my code:

Sub test2()

Sheets("Detail").Shapes("OptionButton2").Select
If Selection.Enabled = True Then
Selection.Enabled = False
Else
Selection.Enabled = True
End If

End Sub

When the design icon in the control toolbox is enabled the code works
fine. Otherwise, when in normal non design mode I get "Object doesn't
support this property or method".

(Reason I have no frame is that the 2 optionbuttons dissapear behind
it)

Any ideas?

Thanks

Andrew

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Enabling Option Buttons - Control

Sub test2()

With Sheets("Detail").OleObjects("OptionButton2").Objec t
If .Enabled = True Then
.Enabled = False
Else
.Enabled = True
End If
End with
End Sub

--
Regards,
Tom Ogilvy



"Andreww" wrote:

Hi - I have two option buttons (controls) on a sheet - no frame round
them.

In a certain scenario I want the 2nd optionbutton to be disabled so
the user can not click in it.

This is my code:

Sub test2()

Sheets("Detail").Shapes("OptionButton2").Select
If Selection.Enabled = True Then
Selection.Enabled = False
Else
Selection.Enabled = True
End If

End Sub

When the design icon in the control toolbox is enabled the code works
fine. Otherwise, when in normal non design mode I get "Object doesn't
support this property or method".

(Reason I have no frame is that the 2 optionbuttons dissapear behind
it)

Any ideas?

Thanks

Andrew


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Enabling Option Buttons - Control

Thanks Tom.

Works a treat, tried all sorts of things but have never come across
the OleObjects thing before.

Regards

Andrew

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
Worksheets and Control Option Buttons KHaydel Excel Worksheet Functions 1 April 9th 07 11:19 PM
How do I create a form in a worksheet with control option buttons. andreah New Users to Excel 2 April 23rd 05 01:12 AM
No control for option buttons, invisible macro?? Steve[_77_] Excel Programming 2 April 13th 05 02:38 PM
Selective control of Option Buttons gtcyberaz Excel Programming 0 February 25th 05 06:03 PM
Control Box Option Buttons jlarkin Excel Programming 4 April 23rd 04 12:31 AM


All times are GMT +1. The time now is 03:16 AM.

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"