title: Userform opening on wrong workbook
body: <p>I have a userform that has a command button to open another userform.  This works well most of the time but there is a particular scenario where it does not work at all.  </p>
  
  <p>The users of said userforms typically work on multiple monitors and also have multiple workbooks open. These other workbooks are not associated with my workbook.</p>
  
  <p>If the user is working in another workbook on monitor 1 and then clicks the button to open the secondary userform on monitor 2, the secondary userform opens on monitor 1 and behaves like it's parent is the other workbook.  To correct this behavior, the user needs to click a cell on monitor 2's workbook and then click the button to open the secondary userform.  So it seems to be a workbook activation issue but this is not the case. </p>
  
  <p>I have tried different methods of activating the correct workbook before showing the secondary userform with code to no avail.</p>
  
  <p>Here's the basic code I use to launch the secondary userform when the button is clicked:</p>
  
  <pre><code>Private Sub CommandButton1_Click()
  
      With UserForm2
          .StartUpPosition = 0
          .Left = Application.Left + (0.5 * Application.Width) - (0.5 * .Width)
          .Top = Application.Top + (0.5 * Application.Height) - (0.5 * .Height)
          .Show vbModeless
  
      End With
  
  End Sub
  </code></pre>
  
  <p>I found this thinking I just need to explicitly set the userforms parent window before showing it but the userform will not open at all with this code:
  <a href="http://www.cpearson.com/excel/SetParent.aspx" rel="nofollow noreferrer">http://www.cpearson.com/excel/SetParent.aspx</a></p>
  
  <p>I hope this makes sense.  It's kind of hard to explain.</p>