Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Mar 2001
    Location
    Silicon Valley, California, USA
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Me.Hide closes VBE window (VBA/Office 2000)

    Hi Folks,

    When I am creating and debugging a UserForm, I add a Cancel command button with Me.Hide as its only code. I then test the form by running it from the VBE. When I click the Cancel button, the form disappears (as it should) and control returns to the VBE. However, the form design window is now closed and I have to open it again from the Project Explorer.

    Does this make sense, and is there a way to prevent it?

  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Me.Hide closes VBE window (VBA/Office 2000)

    The form design window actually closes when you run the userform. Just the way MS designed it.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  3. #3
    3 Star Lounger
    Join Date
    Mar 2001
    Location
    Silicon Valley, California, USA
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Me.Hide closes VBE window (VBA/Office 2000)

    Sheeesh...

    If that is true, then the form design window re-opens when I use the corner X to close the running form, no?

    Is there a rationale for these behaviors or are they some side-effect?

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Me.Hide closes VBE window (VBA/Office 2000)

    The "X" doesn't run the code for the cancel button, so it doesn't run Me.Hide. When I'm doing a lot of quick back-and-forth testing, I've learned to always use the "X" for this reason. But it does raise a question: how do you trap this in a real application? Hmmm...

  5. #5
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Me.Hide closes VBE window (VBA/Office 2000)

    Set the Cancel property of the Cancel button to true?

Posting Permissions

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