Consulting

Results 1 to 4 of 4

Thread: Solved: Userform

  1. #1

    Solved: Userform

    I have searched for hours looking for a way to close all Userforms on commandbutton click (Regardless of weather they are the active userform (on top) or deactivated userform (on bottom). I have all of my userforms ShowModal = False

    Private Sub CmdBtn1_Click()
    Call All_UF_Close
    UF_DashBrd.Show
    UF_CreateWO.Show
    End Sub
    I have tried everything I can think of to achieve the following, however, it does not close the deactivatated UF located on the bottom.

    Public Sub All_UF_Close()
    UF_CreateWO.Hide
    Unload UF_CreateWO
    DoEvents
    UF_UpdateWO.Hide
    Unload UF_UpdateWO
    DoEvents
    UF_CancelWO.Hide
    Unload UF_CancelWO
    DoEvents
    UF_CloseWO.Hide
    Unload UF_CloseWO
    DoEvents
    End Sub

  2. #2
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    This should unload all loaded userforms
    [VBA]Do Until UserForms.Count < 1
    Unload UserForms(0)
    Loop[/VBA]

  3. #3
    Mike -

    Outstanding!

    Thank You

    A Q if I might - a UF on top or bottom is still loaded but Top = active Bottom = deactive?

  4. #4
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    I'm only familiar with modeless userforms.
    That's the way they work for me.

Posting Permissions

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