+ Reply to Thread
Results 1 to 2 of 2

Userform TYpe

  1. #1
    Paul Smith
    Guest

    Userform TYpe

    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



  2. #2
    Norman Jones
    Guest

    Re: Userform TYpe

    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

    ---
    Regards,
    Norman



    "Paul Smith" <[email protected]> wrote in message
    news:[email protected]...
    > 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
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1