# Microsoft Office Application Help - Excel Help forum > Excel Programming / VBA / Macros >  >  how to close a form in vba (not hide)

## Pierre

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

----------


## Ron de Bruin

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" <pf@arobas.net> wrote in message news:%23ZAf4IyhFHA.1968@TK2MSFTNGP14.phx.gbl...
> 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
>
>

----------


## Pierre

thanks again Ron


Ron de Bruin a écrit dans le message
<#JG6SPyhFHA.576@TK2MSFTNGP15.phx.gbl>...
>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" <pf@arobas.net> wrote in message
news:%23ZAf4IyhFHA.1968@TK2MSFTNGP14.phx.gbl...
>> 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
>>
>>
>
>

----------


## anonymousA

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
>
>

----------


## ledenjes

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

Like this:




```
Please Login or Register  to view this content.
```

----------


## Norie

Using End will stop all code execution.

----------


## romperstomper

And reset all variables, including Public ones.

----------

