userform won't hide RRS feed

  • Question

  • Hi,

    I have a problem hiding a userform. From Excel (2003) I run a macro which at some point does

    Useform1.Show. In Userform1 there is (amongst Userform_activate) :



    Now I want Userform1 to close but no matter what I've tried, it stays visible until the program reaches some point further on.

    I have tried Userform1.hide, Unload, etc. but it seems to hide only at the end of my program.

    The version of VB is 6.3.

    I wonder if this is a bug or known issue as all examples I've seen tell me that Userform1.Hide will hide it, but it doesn't !

    Any help will be appreciated.


    Found it just after posting (as usually is the case ;-) ) :

    In the very begin of the program there was a line :

    Application.ScreenUpdating = False

    after removing that all works well !




    • Edited by Ruijt Monday, October 24, 2011 12:41 PM
    • Moved by Kee Poppy Wednesday, October 26, 2011 7:34 AM (From:Visual Basic General)
    Monday, October 24, 2011 11:44 AM


  • Put a button on the form named CommandButton1, maybe change the caption to Quit or Close.
    Past the following in the Userform module

    Private Sub CommandButton1_Click()
       Unload Me
    End Sub

    Run the form, click the button, the form will close and unload from memory.

    If it doesn't close that might be because you have included other code in the routine that unloads the form and hasn't completed or stuck doing something else. Another problem might be if some other object or variable has a reference to the form that hasn't been released.

    Peter Thornton

    • Proposed as answer by danishani Monday, November 28, 2011 9:34 PM
    • Marked as answer by danishani Wednesday, January 11, 2012 8:12 PM
    Wednesday, October 26, 2011 10:55 AM