VB user forms

  • Thread starter Thread starter Madasu
  • Start date Start date
M

Madasu

Hi all,

I started to play with user forms in visual basic. One thing lead to
another and with overwhelming excitement I created my first form. Having
spent all that time I cannot now fathom out how to launch that form whilst
in the excel spread sheet.

I assume that one way would be through a macro button. Does anyone know the
macro code that would be needed to launch a selected user form.

Thanks for any available help or helpful links that I have failed to find
 
If I understand you well, it is very simple. Just put the followin
macro in your vba-module and replace FormName for the name of you
form.

Sub OpenForm()
FormName.Show
End Sub


You can add the macro to a button or menu
 
If I understand you well, it is very simple. Just put the following
macro in your vba-module and replace FormName for the name of your
form.

Sub OpenForm()
FormName.Show
End Sub

I think you understand me polletje. Thanks for the reply. When I create a
macro button and view code I see the following

Private Sub CommandButton1_Click()

End Sub

With the curser in between the two commands.

I have played with your lines but I can't get it to work. I'm sure it's
simple and if I could learn to walk before I ran I would avoid these
situations. Any further help would be appreciated.
 
You should use Show method of a user form like this:

Private Sub CommandButton1_Click()
UserForm1.Show
End Sub
 
Back
Top