Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WithEvents - object variable declaration in class module 1

Status
Not open for further replies.

marklenel

Technical User
Aug 29, 2003
46
GB
I've read the excellent threads & FAQs on simulating control arrays in VBA. In trying to make this work, I'm using the following line of code in a new class module:-

Public WithEvents ButtonArray As CommandButton

...and this allows me the following event:-

Private Sub ButtonArray_Click()


However, when I try:-

Public WithEvents ButtonArray As OptionButton

...it doesn't seem to recognise the event.


Any thoughts would be more than welcome.
 
Excel assumes that you try to refer to excel's form optionbutton (excel's library is higher than MSForms in references dialog).
Declare WithEvents with library name:
[tt]Public WithEvents ButtonArray As MSForms.OptionButton[/tt]

combo
 
You beauty!

Many thanks - nice clear explanation to go with an accurate answer.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top