title: Trying to do Office Automation with Excel 2007, but keeps using Excel 2003
body: <p><b>Environment:</b></p>
  
  <p>Windows XP machine<br>
  Both Excel 2007 and Excel 2003 installed (in that order, not chronologically).<br>
  C# 3.5</p>
  
  <p><b>Problem:</b></p>
  
  <p>When I use the PIAs to do some Office automation, I use the following line of code:</p>
  
  <pre><code>var excel = new ApplicationClass();
  </code></pre>
  
  <p>The PIA's version specifically refers to it as Excel 12.<br>
  C:\WINDOWS\assembly\GAC\Microsoft.Office.Interop.Excel\12.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Excel.dll<br>
  But:</p>
  
  <pre><code> excel.Version;//this is 11.0 instead of 12.0
  </code></pre>
  
  <p>Thus, when I try to open a file with extention .xlsx, it warns me about lost functionality in the file conversion, and opens it with excel 2003. I am pretty sure it has to do with the install order being 2007 -> 2003, but I can't uninstall 2003 on my machine b/c we have some office automation on our webserver for an unrelated project that uses excel 2003. </p>
  
  <p>I've looked at the Policy.11.0.Microsoft.Office.Interop.Excel.config stuff, but it says </p>
  
  <pre><code>&lt;bindingRedirect oldVersion="11.0.0.0" newVersion="12.0.0.0"&gt;&lt;/bindingRedirect&gt;
  </code></pre>
  
  <p>So, I am at a loss. Why can't I tell the COM Interop which version of Excel to use? </p>