title: How to change the title bar text of a Userform in VBA?
body: <p>I'm maintaining an old-ish application written in VBA for Excel 2002 (XP)/2003, and am trying to internationalise it.</p>
  
  <p>To do this, I read in the translated strings dynamically and update the various controls on my userform by updating their .Caption property.</p>
  
  <p>This works as expected for all controls but not for the form itself -- when I change the form's .Caption property, then the title bar keeps displaying the "hard-coded" value, and the new value is instead displayed just below it, at the top of the "canvas" of the form itself.</p>
  
  <p>Is it possible to change the title bar text of a UserForm after it has been shown, or do I have to change the .Caption property of the form before it is shown in order for it to be reflected in the title bar rather than in the canvas/client area?</p>
  
  <p>My code looks something like this:</p>
  
  <pre><code>' in frmFoo
  Private Sub UserForm_Activate()
      ' ...
      TranslateDialog Me, "frmFoo"
      ' ...
  End Sub
  
  ' in a VBA module
  Sub TranslateDialog(pForm As UserForm, pFormName As String)
      Dim new Caption As String
      Const notFound As String = "###!!@@NOTFOUND@@!!###"
      ' ...
      ' GetMessage() returns the translated message for a given key, or the
      ' default value (second parameter) if no translation is available.
      ' The translation key for the form caption is the form name itself.
      newCaption = GetMessage(pFormName, notFound)
      If newCaption &lt;&gt; notFound Then pForm.Caption = newCaption
      ' ...
  End Sub
  </code></pre>
  
  <p>As I said, the assignment to <code>pForm.Caption</code> does have an effect - but it doesn't write to the title bar of the window, but rather directly beneath it. I'm running Excel 2003 on Windows XP SP 3.</p>