UserForm will Neither Hide nor Unload

  • I have a UserForm (named "Update_Status") that I've created to display the status of a subroutine tree that's in process. (By subroutine tree, I mean that I have a series of consecutive subroutines running, not just a single subroutine. Kind of beside the point, but clarity is often a good thing! ;))


    At one point in the process, I need to hide this "Update_Status" UserForm in order to manipulate the spreadsheet data through another UserForm that I've created. Basically, the Update_Status UserForm is in the way, and I need it gone in order to see the spreadsheet data that I'm manipulating. I use several of these types of UserForms in the process, so I'm very comfortable with understanding how to manipulate them, and I've been writing this type of code using UserForms for years.


    However, I can't get the Update_Status UserForm to go way. Arrrggghh! (Die! Die! Die! Already!)


    I've tried:


    Code
    Update_Status.Hide


    Code
    Unload Update_Status


    Code
    Update_Status.Hide
    DoEvents


    Code
    Unload Update_Status
    DoEvents


    Out of crushing frustration, I even went overboard with:


    Yet, my UserForm persists. ??? Really. Come on! Just die already!


    Okay, so if I step through the code, it dies fine. :)


    Here's my actual code:


    Like I said, if I step-through the code, it dies fine. If I run the code, it doesn't.


    If I put a breakpoint on the "If MsgBox("No current update file found." line (as shown below, designated by the asterisk (*)), and run the code, the code stops at that line, waiting for me to continue the step-through, but the Update_Status UserForm is still *expletive* displayed! (Seriously! Just DIE already!)


    Code
    Unload Update_Status
                        DoEvents
                    'Determine what the user wants to do.
    *                   If MsgBox("No current update file found." & vbCrLf & vbCrLf & _
                                  "To STOP processing, click the ""No"" button." & vbCrLf & vbCrLf & _
                                  "To CONTINUE processing, and open a file to use as the current Update file, click the ""Yes"" button.", vbYesNo) = vbNo Then


    So it obviously has to run through the "Unload Update_Status" line to get to the breakpoint, but it's ignoring the statement, as even when the VBA stops at my breakpoint, the UserForm is still displayed!


    If I manually move the Run Cursor (sorry if it's actually called something else; it's what I call it, and I've never taken the time to look it up.) three lines back to the "Unload Update_Status" line, and either run the code or step-through it, the UserForm goes away.


    But the for the life of me, I can't get it to do it in realtime.


    (For what it's worth: Windows 7, Excel 2010)


    If there's something simple that I am just somehow overlooking, Great! :) Make me happy. If there's something deeper, and you can show me how to fix it, even better! :)


    Thoughts? :)

  • Re: UserForm will Neither Hide nor Unload


    Do you just want your userform to hide until your next move?
    If so, did you try userfomname.visible =false ? And after you do your thing you can set it back to true?

  • Re: UserForm will Neither Hide nor Unload


    Ah! Okay. I guess I'm tired. ;) (I've only been working 20-hour days on this for a month and a half. Ha!)


    Found my problem, but I'm leaving the thread alive to let someone else get the benefit of me being an idiot! (Most of my Excel problems are because I'm an idiot! LOL! Most of my problems in all of *life* are probably because of that, too! ;))


    Code
    Application.ScreenUpdating = True


    Yeah, that kind of does it.


    I had my ScreenUpdating set to False in a previous subroutine, which I knew, and did intentionally, and totally didn't even seem to think about enough to set it back to True during this dialog session. (sigh.)


    Eh, there you go for someone else, if ever they see this thread. :))


    (This is why I don't like to post questions on forums: I generally figure things out before I get a viable answer from someone else. LOL! ;))

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!