title: Get Window position of a Visio Application
body: <p><strong>Intro:</strong> </p>
  
  <p>I've run into an issue when I tried to position Visio-UserForms relative to the calling Visio application window, as it is possible in other MS Office applications.<br>
  Normally I would use calling code like in the first block (Excel) to open a UserForm in a relative position to the application window.<br>
  The important properties for this uqestion are <code>.Left</code> and <code>.Top</code>, which return the offset of the window compared to the screen. </p>
  
  <p>If I try the same in Visio (code block 2) I ran into the following Issue:
  The application object of a the Visio application (<code>vsApp</code>) does not support the <code>.Top</code> an <code>.Left</code> properties, so obviously I get the standart <code>Run.time error "438": “Object doesn't support this property or method”</code></p>
  
  <p><strong>Question:</strong></p>
  
  <p>My question is if there is an alternative relatively clean method to get the window position of the calling application (maybe even application-agnostic). When looking around there are a multitude of solutions for Excel, but none for Visio as far as I can tell.</p>
  
  <p>This is my first question here, so please if I submitted something wrong or missed a rule/guideline please let me know.</p>
  
  <p><strong>Code:</strong></p>
  
  <p>In both cases the FooUserForm is a simple UserForm with a single button that hides the form with <code>Me.Hide</code>. The code below resides in a standard module</p>
  
  <p>Code in Excel:</p>
  
  <pre><code>Option Explicit
  
  Sub openFooUserForm()
  
      Dim fooUF As FooUserForm
      Set fooUF = New FooUserForm
  
      Dim exApp As Excel.Application
      Set exApp = ThisWorkbook.Application
  
      fooUF.StartUpPosition = 0
      fooUF.Top = exApp.Top + 25
      fooUF.Left = exApp.Left + 25
  
      fooUF.Show
  
      Set fooUF = Nothing
  
  End Sub
  </code></pre>
  
  <p>Code in Visio:</p>
  
  <pre><code>Option Explicit
  
  Sub openFooUserForm()
  
      Dim fooUF As FooUserForm
      Set fooUF = New FooUserForm
  
      Dim vsApp As Visio.Application
      Set vsApp = ThisDocument.Application
  
      fooUF.StartUpPosition = 0
      fooUF.Top = vsApp.Top + 25
      fooUF.Left = vsApp.Left + 25
  
      fooUF.Show
  
      Set fooUF = Nothing
  
  End Sub
  </code></pre>