Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: apply vbs form to click button

  1. #1
    Board Regular
    Join Date
    Mar 2002
    Location
    Arkansas
    Posts
    358
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    New at vbs, can anyone tell me how, after writing a form in visual, to attach it to a click button in excel where it will pull the form up. Thx Dan

  2. #2
    MrExcel MVP Mark O'Brien's Avatar
    Join Date
    Feb 2002
    Location
    Columbus, OH, USA
    Posts
    3,530
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Right click on the name tab of the worksheet that contains the button, choose "View Code". In the VB editor that comes up you will see two drop-down menus, one will say "(General)" and the other will say ")Declarations"). Click on the arrow for the "(General)" box, and you should see the name of your button in that list. Select that button. You will now see some code in the window that says something like:


    Private Sub CommandButton1_Click()

    End Sub


    Put your code to show the userform in here. e.g. if your userform is called "UserForm1" then you put this line of code in to show the userform:


    UserForm1.Show


    Go back to your work book and hopefully if you click your button the userform will show. If nothing happens that check the toolbar called "Control Toolbox" and make sure that the "Design Mode" button hasn't been pressed.

    HTH

  3. #3
    Board Regular
    Join Date
    Mar 2002
    Location
    Arkansas
    Posts
    358
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks Mark works great, so simple but I could not figure it out. Thanks again.

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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