Userform TYpe

P

Paul Smith

For reasons only know to me, I would like to write a function that can be
called on the click event of a cancel on any userform which will unload the
form.

I have the two pieces of code below but I when I click the cancel form I get
the error message below - whatever type I use as the type of the argument in
the function.

Run-time error '13':
Type Mismatch

Any ideas anyone?

PWS

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Private Sub cmdCancel_Click()

CancelFormRecord (frmPssd)

End Sub


Public Function CancelFormRecord(frmPssd As ????) As Boolean

Unload frmPssd

End Function
 
N

Norman Jones

Hi Paul,

Private Sub cmdCancel_Click()
CancelFormRecord Me
End Sub

Public Function CancelFormRecord(frmPssd As UserForm)
Unload frmPssd
End Function

Worked for me . (No pun intended!)


Howver, why would you wish to do this rather than the simple:

Private Sub cmdCancel_Click()
Unload Me
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top