title: Userform resilient to Unload call
body: <p>I am having a weird issue trying to <code>Unload</code> Useforms before showing another one.<br />
  My worksheet is made of a master <code>UserForm</code>, called <code>UFMainMenu</code>, which can call others. When the master one call an userform, it hides using something like this in the master UserForm code:</p>
  <pre><code>Private Sub BtnSupprimerValeur_Click()
      Me.Hide
      UFSupInstanceParametre.Show
  End Sub
  </code></pre>
  <p>This works as intended, and opens <code>UFSupInstanceParametre</code><br />
  Inside <code>UFSupInstanceParametre</code>, if user closes it, the code <code>Unload</code> <code>UFSupInstanceParametre</code> and launches back my master <code>UserForm</code>:</p>
  <pre><code>Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
      If CloseMode = vbFormControlMenu Then
          Unload Me
          Call mainMenu
      End If
  End Sub
  </code></pre>
  <p>mainMenu is this simple sub :</p>
  <pre><code>Sub mainMenu()
      Application.ScreenUpdating = True
      
      Dim objLoop As Object
      'The following loop is just for me to see if previous userform was indeed unloaded, and if not it unloads it again
      For Each objLoop In VBA.UserForms
          If objLoop.Name &lt;&gt; &quot;UFMainMenu&quot; Then
              Unload objLoop
          End If
      Next objLoop
      
      UFMainMenu.Show
      
  End Sub
  </code></pre>
  <p>The problems are :<br />
  -The <code>Unload Me</code> inside <code>UFSupInstanceParametre</code> doesn't indeed Unload <code>UFSupInstanceParametre</code>, since it still appears on screen.<br />
  -Inside the <code>For</code> Loop in mainMenu, when ran steps by steps I see that <code>UFSupInstanceParametre</code> hasn't been unloaded, and I confirm that the code then runs the line <code>Unload objLoop</code>, which should unload it anyway. It doesn't, <code>UFSupInstanceParametre</code> is still on screen. To be 100% sure that it isn't unloaded, I tried running a second time the <code>For</code> Loop, which found again <code>UFSupInstanceParametre</code> as still loaded, and again tried to Unload it with the line <code>Unload objLoop</code>, without success.
  -Code throws no error, it just won't unload any userform.
  -Code launches the master Userform as intended after trying to unload others in mainMenu, but with the other one still visible behind.</p>
  <p>I have to admit that I'm kinda lost on this one, I know that there is just one simple property about UserForms that I am missing, but no way for me to find it.</p>
  <p>Any ideas?</p>