+ Reply to Thread
Results 1 to 7 of 7

how to close a form in vba (not hide)

  1. #1
    Pierre
    Guest

    how to close a form in vba (not hide)

    Hi all,

    i have an initialisation problem.

    i am using a form to add data to an excel sheet.

    When the user has finish his work he click on a button
    and i use:

    userform1.hide in the on click event

    to close the form because i cannot do what i really want wich is to close
    the
    form.

    How can i close or unload the form?

    after that, if the user call back the macro, the initialize function of the
    form is not called
    (because it is simply hide) and this screw my initialisation.

    I want a clean way to close or quit or unload the form.
    help

    regards,
    pierre



  2. #2
    Ron de Bruin
    Guest

    Re: how to close a form in vba (not hide)

    Hi Pierre

    Use

    Unload Me

    See also
    http://support.microsoft.com/default...b;EN-US;829070



    --
    Regards Ron de Bruin
    http://www.rondebruin.nl


    "Pierre" <[email protected]> wrote in message news:%[email protected]...
    > Hi all,
    >
    > i have an initialisation problem.
    >
    > i am using a form to add data to an excel sheet.
    >
    > When the user has finish his work he click on a button
    > and i use:
    >
    > userform1.hide in the on click event
    >
    > to close the form because i cannot do what i really want wich is to close
    > the
    > form.
    >
    > How can i close or unload the form?
    >
    > after that, if the user call back the macro, the initialize function of the
    > form is not called
    > (because it is simply hide) and this screw my initialisation.
    >
    > I want a clean way to close or quit or unload the form.
    > help
    >
    > regards,
    > pierre
    >
    >




  3. #3
    Pierre
    Guest

    Re: how to close a form in vba (not hide)

    thanks again Ron


    Ron de Bruin a écrit dans le message
    <#[email protected]>...
    >Hi Pierre
    >
    >Use
    >
    >Unload Me
    >
    >See also
    >http://support.microsoft.com/default...b;EN-US;829070
    >
    >
    >
    >--
    >Regards Ron de Bruin
    >http://www.rondebruin.nl
    >
    >
    >"Pierre" <[email protected]> wrote in message

    news:%[email protected]...
    >> Hi all,
    >>
    >> i have an initialisation problem.
    >>
    >> i am using a form to add data to an excel sheet.
    >>
    >> When the user has finish his work he click on a button
    >> and i use:
    >>
    >> userform1.hide in the on click event
    >>
    >> to close the form because i cannot do what i really want wich is to close
    >> the
    >> form.
    >>
    >> How can i close or unload the form?
    >>
    >> after that, if the user call back the macro, the initialize function of

    the
    >> form is not called
    >> (because it is simply hide) and this screw my initialisation.
    >>
    >> I want a clean way to close or quit or unload the form.
    >> help
    >>
    >> regards,
    >> pierre
    >>
    >>

    >
    >




  4. #4
    anonymousA
    Guest

    Re: how to close a form in vba (not hide)

    Hi,

    unload userform1 will be fine.


    Pierre a écrit :
    > Hi all,
    >
    > i have an initialisation problem.
    >
    > i am using a form to add data to an excel sheet.
    >
    > When the user has finish his work he click on a button
    > and i use:
    >
    > userform1.hide in the on click event
    >
    > to close the form because i cannot do what i really want wich is to close
    > the
    > form.
    >
    > How can i close or unload the form?
    >
    > after that, if the user call back the macro, the initialize function of the
    > form is not called
    > (because it is simply hide) and this screw my initialisation.
    >
    > I want a clean way to close or quit or unload the form.
    > help
    >
    > regards,
    > pierre
    >
    >


  5. #5
    Registered User
    Join Date
    07-14-2014
    Location
    Amsterdam, Netherlands
    MS-Off Ver
    2010
    Posts
    2

    Re: how to close a form in vba (not hide)

    I found you can also just use the "End" command.

    Like this:

    Please Login or Register  to view this content.

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: how to close a form in vba (not hide)

    Using End will stop all code execution.
    If posting code please use code tags, see here.

  7. #7
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: how to close a form in vba (not hide)

    And reset all variables, including Public ones.
    Remember what the dormouse said
    Feed your head

+ 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