+ Reply to Thread
Results 1 to 2 of 2

Userform from a Userform Problem

  1. #1
    Adrian
    Guest

    Userform from a Userform Problem

    I have an excel workbook which when opened runs a userform. On this userform
    are various commandbuttons which do various things.

    One button (commandButton1), hides the current form then opens a userform
    called setup, when that userform is closed using 'unload me' in the setup
    userform code control passes back to the Command Button 1 click procedure,
    the next line of which is to re-show the first userform. This works fine -
    no problems.
    The code which achieves this little bit is here:

    Private Sub CommandButton1_Click()
    Me.Hide
    Setup.Show
    Me.Show
    End Sub

    The second button does a similar thing but with a different userform. The
    closure for this is the same as before (ie an unload me in the code of the
    second form). Again this form worked just fine UNTIL ...
    I added a control on the second userform (confusingly called userform1).
    After adding this one control the userform closes just fine, but the original
    form doesnt stay opened. Using debug, I have followed the code through and
    it executes corrrectly, including showing the userform again (me.show). But
    when it executes the EndSub the form closes.

    The code is (except for userform names) identical.
    Private Sub CommandButton2_Click()
    Me.Hide
    UserForm1.Show
    Me.Show
    End Sub

    Why doesnt it work? What can I do about it?
    Ive gone back to my original and done it all again in case I had stuffed
    something up, but no success.

    Its Excel 2003 sp1 running on a Windows 2000 SP 4 server.

    Thanks

    Adrian

  2. #2
    Bob Phillips
    Guest

    Re: Userform from a Userform Problem

    Adrian,

    I couldn't replicate this behaviour, Excel 2002.

    What control did you add, and is there anything else that might be relevant.

    --
    HTH

    Bob Phillips

    "Adrian" <Adrian@discussions.microsoft.com> wrote in message
    news:D021170C-8139-417B-A7BA-CBB1A3788C44@microsoft.com...
    > I have an excel workbook which when opened runs a userform. On this

    userform
    > are various commandbuttons which do various things.
    >
    > One button (commandButton1), hides the current form then opens a userform
    > called setup, when that userform is closed using 'unload me' in the setup
    > userform code control passes back to the Command Button 1 click procedure,
    > the next line of which is to re-show the first userform. This works

    fine -
    > no problems.
    > The code which achieves this little bit is here:
    >
    > Private Sub CommandButton1_Click()
    > Me.Hide
    > Setup.Show
    > Me.Show
    > End Sub
    >
    > The second button does a similar thing but with a different userform. The
    > closure for this is the same as before (ie an unload me in the code of the
    > second form). Again this form worked just fine UNTIL ...
    > I added a control on the second userform (confusingly called userform1).
    > After adding this one control the userform closes just fine, but the

    original
    > form doesnt stay opened. Using debug, I have followed the code through

    and
    > it executes corrrectly, including showing the userform again (me.show).

    But
    > when it executes the EndSub the form closes.
    >
    > The code is (except for userform names) identical.
    > Private Sub CommandButton2_Click()
    > Me.Hide
    > UserForm1.Show
    > Me.Show
    > End Sub
    >
    > Why doesnt it work? What can I do about it?
    > Ive gone back to my original and done it all again in case I had stuffed
    > something up, but no success.
    >
    > Its Excel 2003 sp1 running on a Windows 2000 SP 4 server.
    >
    > Thanks
    >
    > Adrian




+ 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