Simple form question

  • Thread starter Thread starter Stuart
  • Start date Start date
S

Stuart

Sheet1 has a commandbutton. When clicked, a form containing one label, an Ok
button and a Cancel button, loads.
I cannot get the buttons to fire the events!

In sheet1 I have:
Private Sub CommandButton1_Click()
Call HandleTheForms
End Sub

In module1 I have:
Private Sub HandleTheForms()
Frm_Initial.Show
End Sub

Behind the form, I have:
Private Sub Cb1Ok_Click()
MsgBox "Success with Ok_Click"
End Sub

Private Sub Cb2Cancel_Click()
MsgBox "Success with Cancel_Click"
Exit Sub
End Sub

Help, feel like I've forgotten what little I thought I knew.

Regards.
 
Change the Private Sub HandleTheForms() to Public Sub HandleTheForms().
That should work.
 
Works fine for me, except that the sub in the module needs to be public to
be called from the worksheet using your syntax.
 
Hi,
- By "Behind the Form" you mean within the Frm_Initial code module, don't you?
- are you really sure the buttons are called Cb1Ok and Cb2Cancel, and not
just cbOK and cbCancel, or any other names?

Regards,
Sébastien
 
Back
Top