title: Accessing an open Excel Workbook in C#
body: <p>I need to access an excel file that is already open. I thought just inspecting the <code>.Workbooks</code> property that it would be there but it isn't. What is the right way to get a reference to the open workbook?</p>
  
  <pre><code>var app = new Microsoft.Office.Interop.Excel.Application();
  
  // the count is 0 =(
  app.Workbooks.Count == 0;
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>I can get a reference to the Excel Application via...</p>
  
  <pre><code>app = (Excel.Application)Marshal.GetActiveObject("Excel.Application");
  </code></pre>
  
  <p>but <code>app.Workbooks.Count</code> is still <code>0</code> why isn't it able to get a reference to the opened workbook?</p>