how to close a userform

  • Thread starter Southern at Heart
  • Start date
S

Southern at Heart

How do you add code to your commandbutton, so that after it has performed
it's request, it closes the Userform?
I tried the unload command, like in Access, but I maybe don't have the
syntax right...
thanks
Southern@Heart
 
S

Shauna Kelly

Hi

Within a form,
Me.Hide
will hide the form. You need to unload it later.

Within a form,
Unload Me
will unload the form from memory.

Or, in a standard module or a class module, you can create a variable to
hold an instance of the form, eg:

Dim frm as MyUserForm

set frm = new MyUserForm
frm.Show
'let the form do its stuff.
'have the OK button do Me.Hide

'back in the main module
Unload frm


Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
 

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