+ Reply to Thread
Results 1 to 5 of 5

Hide a UserForm on workbook deactivation

  1. #1
    Forum Contributor
    Join Date
    08-04-2005
    Location
    Madrid, Spain
    MS-Off Ver
    2010
    Posts
    213

    Hide a UserForm on workbook deactivation

    I often have several workbooks open and shift from one to another.
    One of these contains a floating UserForm; and the trouble is that when I leave this workbook and shift to another one, the UserForm belonging to the first remains open and visible in the new workbook; and I cannot hide this nuisance.
    Within the same workbook, it’s easy to hide the Useform when shifting to another worksheet (through code for Private Sub Worksheet_Deactivate()).
    Is there something similar for when the whole workbook is deactivated?

    Thanks for any help.
    ACA
    Last edited by aca; 11-16-2009 at 03:14 PM.

  2. #2
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243

    Re: ¿Hiding a UserForm on deactivating the workbook?

    hi Aca,

    Yes, there is. Double click on the Thisworkbook module in the VBE, to open up the code window. At the top of the code window there should (?) be 2 dropdown boxes which probably state "(General)" & "(Declarations)". Change the left dropdown to "Workbook" & then look at the list of events by clicking on the righthand dropdown. I'm sure you'll find it by yourself (&... you can use this approach in other modules too, to identify possibilities) but you should end up with something like:
    Please Login or Register  to view this content.
    hth
    Rob
    Rob Brockett
    Kiwi in the UK
    Always learning & the best way to learn is to experience...

  3. #3
    Forum Contributor
    Join Date
    08-04-2005
    Location
    Madrid, Spain
    MS-Off Ver
    2010
    Posts
    213

    Re: ¿Hiding a UserForm on deactivating the workbook?

    Thank you, Rob. Your instructions work perfectly.
    Excuse me for being so inexpert as not to have thought of that myself, and having troubled you for that. Sorry.
    ACA

  4. #4
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243

    Re: ¿Hiding a UserForm on deactivating the workbook?

    Oi!
    No need to apologise - all I meant to do in my last post was provide you with more knowledge that you can use in your future coding

    Thanks for the feedback, I'm pleased I could help. Can you please mark the thread as solved?
    Also, feel free to add to my reputation by clicking on the blue scales - it is appreciated

    Rob

  5. #5
    Forum Contributor
    Join Date
    08-04-2005
    Location
    Madrid, Spain
    MS-Off Ver
    2010
    Posts
    213

    Re: ¿Hiding a UserForm on deactivating the workbook?

    Yes, Rob, I willingly and obligingly add to your reputation.
    Thanks again
    ACA
    Last edited by aca; 11-16-2009 at 03:26 PM.

+ 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