title: Set Focus on an Excel User Form Using VBA
body: <p>I got my project 95% done but a small issue remains. My code, run from a user form, opens a PDF document with its first line, identifies its window in the second and moves and resizes that window in the third.</p>
  <pre><code>    ActiveWorkbook.FollowHyperlink Mail(0) &amp; Mail(Me.Tag)
      Wnd = FindWindow(vbNullString, AcrobatWindowID(Mail(Me.Tag)))
      SetWindowPos Wnd, HWND_TOP, 1950, 10, 1100, 1300, SWP_NOACTIVATE
  </code></pre>
  <p>At the end of this operation the user form is dimmed out. The focus seems to remain with the PDF. That doesn't really matter because the form is fully developed and I can click on it or the PDF to activate either, just the way I wanted.</p>
  <p>Nevertheless I tried to give the focus to the form and then to a particular control. I succeeded in finding the Excel window but failed to set the focus on the form, not to mention the control. In fact, I don't know how to check if I succeeded in setting the focus on the Excel window. I used this code in my attempt of whose syntax I'm not sure.</p>
  <pre><code>Public Const SWP_NOMOVE = &amp;H2           ' ignore cx and cy
  Public Const SWP_NOSIZE = &amp;H1           ' ignore X and Y
  
  SetWindowPos Wnd, HWND_TOP, 0, 0, 0, 0, (SWP_NOMOVE + SWP_NOSIZE)
  </code></pre>
  <p>Anyway, the form remains dimmed out. Does anyone have advice for me?</p>