title: Excel VSTO Workbooks.Open only working when another action is taken first
body: <p>I am working on a VSTO add-in.  I have a customized ribbon, and on that ribbon a button called <code>TemplateCallButton</code>.  I also have several other functions and buttons, one of which just opens a folder with templates (included as example).  The <code>TemplateCallButton</code> only works and adds in a template file if one of the other actions has been completed (seemingly doesn't matter which one). After any other action has run then it works as expected.</p>
  
  <p>What's more frustrating is that this behavior only seems to happen on machines I deploy on, and not the one I'm developing on.  Here is the <code>TemplateCallButton</code> code:</p>
  
  <pre><code>Public Class InsightLabProcessor
    Dim MainTemplatePath As String = "C:\Insight\Insight.xltm"
    ....
    Private Sub TemplateCallButton_Click(sender As Object, e As RibbonControlEventArgs) Handles TemplateCallButton.Click
      Dim objApp As Excel.Application
      objApp = Marshal.GetActiveObject("Excel.Application")
      objApp.Visible = True
      Dim objWorkbook As Excel.Workbook = objApp.Workbooks.Open(MainTemplatePath)
      objWorkbook.Worksheets(4).Activate()
    End Sub
  </code></pre>
  
  <p>and here is the code for the button that just opens a folder:</p>
  
  <pre><code>Private Sub PhaseCodeFolderOpenButton_Click(sender As Object, e As RibbonControlEventArgs) Handles PhaseCodeFolderOpenButton.Click
      Process.Start("explorer.exe", "C:\Insight\Phase Codes")
  End Sub
  </code></pre>
  
  <p>or one that opens the control form:</p>
  
  <pre><code>Private Sub ControlPannel_Click(sender As Object, e As RibbonControlEventArgs) Handles ControlPannel.Click
      Dim controlpanel As New ControlPanel
      controlpanel.Show()
      controlpanel = Nothing
  End Sub
  </code></pre>
  
  <p>I feel like I must be missing something simple.</p>
  
  <p>Thanks.</p>