+ Reply to Thread
Results 1 to 6 of 6

Displaying one userform from another

  1. #1
    Registered User
    Join Date
    09-15-2005
    Posts
    24

    Displaying one userform from another

    Ok, this is such a rediculously simple problem, I am almost too embarrassed to ask. After searching high and low, I cannot for the life of me figure out how to display one userform, when a user clicks on a button in another?

    A simple Userform2.show does not work- the code breaks with an "object required" error.

    I know I'm going to kick myself when I see the answer ... (can you delete topics you started yourself so i can hang my head in shame in private? )
    Last edited by CFD; 10-05-2005 at 11:14 PM.
    Science is a lot like ***: Sometimes something useful comes out, but that is not the reason we are doing it. - Richard Feynman

  2. #2
    Norman Jones
    Guest

    Re: Displaying one userform from another

    Hi CFD,

    I could not reproduce your error and

    Private Sub CommandButton1_Click()
    UserForm2.Show
    End Sub

    worked for me.


    ---
    Regards,
    Norman



    "CFD" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Ok, this is such a rediculously simple problem, I am almost too
    > embarrassed to ask. After searching high and low, I cannot for the life
    > of me figure out how to display one userform, when a user clicks on a
    > button in another?
    >
    > A simple Userform2.show does not work- the code breaks with an "object
    > required" error.
    >
    > I know I'm going to kick myself when I see the answer ... (can you
    > delete topics you stated yourself so i can hang my head in shame?)
    >
    >
    > --
    > CFD
    >
    >
    > ------------------------------------------------------------------------
    > CFD's Profile:
    > http://www.excelforum.com/member.php...o&userid=27306
    > View this thread: http://www.excelforum.com/showthread...hreadid=473653
    >




  3. #3
    Registered User
    Join Date
    09-15-2005
    Posts
    24
    Hmmm was your command button on a different userform, or on a worksheet?

    I can get it to open using a button on a worksheet, but not a button on a different user form.

  4. #4
    cush
    Guest

    RE: Displaying one userform from another

    Perhaps you are not putting your code in the correct location:

    1. Open your VB editor
    2. Select Userform1
    3. Dbl click on the command button to view the code for this button
    4. Paste Norman Jones code in this module. It's not a normal module,
    but rather a special kind of module that contains the code for the userform1
    and associated controls, like buttons.

    HTH

    "CFD" wrote:

    >
    > Ok, this is such a rediculously simple problem, I am almost too
    > embarrassed to ask. After searching high and low, I cannot for the life
    > of me figure out how to display one userform, when a user clicks on a
    > button in another?
    >
    > A simple Userform2.show does not work- the code breaks with an "object
    > required" error.
    >
    > I know I'm going to kick myself when I see the answer ... (can you
    > delete topics you stated yourself so i can hang my head in shame?)
    >
    >
    > --
    > CFD
    >
    >
    > ------------------------------------------------------------------------
    > CFD's Profile: http://www.excelforum.com/member.php...o&userid=27306
    > View this thread: http://www.excelforum.com/showthread...hreadid=473653
    >
    >


  5. #5
    Registered User
    Join Date
    09-15-2005
    Posts
    24
    Thanks cush. My code is certainly in the right place, associated with the correct button on the userform ... Here is the code associated with the button
    Please Login or Register  to view this content.
    Box_details is the first userform (on which CommandButton1 is located), box_contents is the userform for the next step. The code dies at the "box_contents.Show" point.

  6. #6
    Registered User
    Join Date
    09-15-2005
    Posts
    24
    FIXED

    .... it was an error in the initialize routine for the second userform!!! The code broke at the command button point and not in the initialization script, which led me to think it was the display that was the problem!

    So sorry to have wasted all your time, (as he shrinks back in the corner feeling very embarrassed!). It is however annoying that it broke at the command button point, and not the point in the initializer routine that was the problem! Made tracking the error very difficult!

+ 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