+ Reply to Thread
Results 1 to 4 of 4

Loading Userform

  1. #1
    Steven Cheng
    Guest

    Loading Userform

    I am having some challenges on getting a command button to load and show a
    user form

    this is the code for the command button on each of the worksheets to load
    and show the userform:

    Private Sub CommandButton1_Click()
    LoadForm
    End Sub

    this is the code for LoadForm which is located in a module.

    Sub LoadForm()
    Load UserForm1
    UserForm1.Show
    End Sub

    I can't see why that I am getting an error message that indicates the
    application-defined or object defined error.

  2. #2
    Brian
    Guest

    Re: Loading Userform

    Change the "CommandButton1" to just "Button1".

    It should work fine.

    Brian



    "Steven Cheng" <[email protected]> wrote in message
    news:[email protected]...
    >I am having some challenges on getting a command button to load and show a
    > user form
    >
    > this is the code for the command button on each of the worksheets to load
    > and show the userform:
    >
    > Private Sub CommandButton1_Click()
    > LoadForm
    > End Sub
    >
    > this is the code for LoadForm which is located in a module.
    >
    > Sub LoadForm()
    > Load UserForm1
    > UserForm1.Show
    > End Sub
    >
    > I can't see why that I am getting an error message that indicates the
    > application-defined or object defined error.




  3. #3
    Steven Cheng
    Guest

    RE: Loading Userform

    Thanks for responding Brian. However, I changed the button name but it sill
    came up with the same error message.

    Is there something else that I am missing?

    "Steven Cheng" wrote:

    > I am having some challenges on getting a command button to load and show a
    > user form
    >
    > this is the code for the command button on each of the worksheets to load
    > and show the userform:
    >
    > Private Sub CommandButton1_Click()
    > LoadForm
    > End Sub
    >
    > this is the code for LoadForm which is located in a module.
    >
    > Sub LoadForm()
    > Load UserForm1
    > UserForm1.Show
    > End Sub
    >
    > I can't see why that I am getting an error message that indicates the
    > application-defined or object defined error.


  4. #4
    JNW
    Guest

    RE: Loading Userform

    Remove "Load UserForm1". UserForm1.show will work to open the form.

    If that doesn't work than you'll need to check the names of the button and
    the userform. if you change those names the events and macros will no longer
    work.

    "Steven Cheng" wrote:

    > I am having some challenges on getting a command button to load and show a
    > user form
    >
    > this is the code for the command button on each of the worksheets to load
    > and show the userform:
    >
    > Private Sub CommandButton1_Click()
    > LoadForm
    > End Sub
    >
    > this is the code for LoadForm which is located in a module.
    >
    > Sub LoadForm()
    > Load UserForm1
    > UserForm1.Show
    > End Sub
    >
    > I can't see why that I am getting an error message that indicates the
    > application-defined or object defined error.


+ 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