View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Michel S. Michel S. is offline
external usenet poster
 
Posts: 33
Default XL-2003 - Class Module - Controls declared "withEvents" don't sink events..

Hello !

Given the following code :

' == clsBtn Class module

Private WithEvents mCmdOk AS MSForms.CommandButton

Public Property Set Ok (cmd AS MSForms.CommandButton)
Set mCmdOk = cmd
End Property

Private Sub mCmdOk_Click()
MsgBox "Ok button clicked"
End Sub

' == User Form
Private objBtn AS clsBtn

Private Sub UserForm_Initialize
Dim objBtn as New clsBtn
Set objBtn.Ok = Me.ExistingCmdBtnOnThisForm
End Sub


When I click on "Me.ExistingCmdBtnOnThisForm", I expect the MsgBox to
pop, but nothing happens.

Any idea why it doesn't work ?
Thanks