LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default OptionButton type name?

I'm having a TypeName problem and need some ideas.

To see my problem, put two option buttons from Control Toolbox (not Forms)
on your worksheet. Then, in the Sheet1 module, set up this code:

Private Sub OptionButton1_Click()
Foo OptionButton1
End Sub

Private Sub OptionButton2_Click()
Foo OptionButton2
End Sub

Sub Foo(Button As OptionButton)
Debug.Print "Success!"
End Sub

When I click on an option button I get a Run Time Error 13, Type mismatch.

This is strange, because when I use the Immediate pane to enter...
Print TypeName(OptionButton1)
....I'm told that OptionButton12 is, indeed, an OptionButton.

Obviously, in Foo, I could define Button as a variant. But that just ignores
the problem. Why am I getting an error when I define an option button as an
option button?

Thanks.

Charley


 
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
optionbutton - three options Sian Excel Discussion (Misc queries) 7 January 5th 08 10:29 AM
Optionbutton troubles Mats Samson Excel Worksheet Functions 2 September 27th 07 03:54 PM
OptionButton. Reset to 0 Eef Houniet New Users to Excel 7 September 3rd 06 12:14 PM
How Do I Tab From An OptionButton To A TextBox Minitman Excel Discussion (Misc queries) 0 February 23rd 05 09:34 PM
Use Arrow keys in optionbutton JON-JON Excel Programming 3 September 3rd 03 08:03 AM


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