title: VBA - Word 2007 - Subscript out of range (error 9)
body: <p>I don't know what's causing this. 
  I've created a template with a lot of macro code in it. And I've used the Custom UI EDitor for Office 2007 applications to create a custom Tab in the Ribbon interface. In this tab I've got this button which is supposed to open a userform. The XML code for the button is this:</p>
  
  <pre><code>&lt;customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"&gt;
      &lt;ribbon startFromScratch="false"&gt;
          &lt;tabs&gt;
              &lt;tab id="CustomForm" label="CustomForm"&gt;
                  &lt;group id="customuserdata" label="Custom Userdata"&gt;
                      &lt;button id="openForm" label="Open userform" imageMso="OpenForm" size="large" onAction="openForm" /&gt;
                  &lt;/group&gt;
              &lt;/tab&gt;
          &lt;/tabs&gt;
      &lt;/ribbon&gt;
  &lt;/customUI&gt;
  </code></pre>
  
  <p>And in the same Template I've got a Public Sub named <code>openForm</code> and it this I just run <code>myForm.Show</code>. It's in this sub that the error occurs "Run-Time error '9'. SubScript out of range". What could cause this?</p>
  
  <p>The exact code of the Sub I'm trying to call is this:</p>
  
  <pre><code>Public Sub openForm(control As IRibbonControl)
      FormAltData.Show ' This is where the debugger stops at'
  End Sub
  </code></pre>