title: C# Excel casting
body: <p>I have an existing project that creates an excel spreadsheet using the <code>Microsoft.Office.Interop.Excel.WorkbookClass</code> and I am trying to convert the workbook object to the <code>Microsoft.Office.Tools.Excel.Workbook</code>, but I am getting an exception thrown stating: </p>
  
  <blockquote>
    <p>"Unable to cast COM object of type
    'Microsoft.Office.Interop.Excel.WorkbookClass' to class type
    'Microsoft.Office.Tools.Excel.Workbook'.  Instances of types that
    represent COM components cannot be cast to types that do not represent
    COM components; however they can be cast to interfaces as long as the 
    underlying COM component supports QueryInterface calls for the IID of
    the interface."</p>
  </blockquote>
  
  <pre><code>Microsoft.Office.Interop.Excel.Application xlApp = null;
  Microsoft.Office.Tools.Excel.Workbook xlWorkbook = null;
  Microsoft.Office.Interop.Excel.Sheets xlSheets = null;
  Microsoft.Office.Tools.Excel.Worksheet xlNewSheet = null;
  
  xlApp = new Interop.Application();
  xlApp.Visible = true;
  xlWorkbook = (Microsoft.Office.Tools.Excel.Workbook)xlApp.Workbooks.Add(Interop.XlWBATemplate.xlWBATWorksheet);
  xlSheets = xlWorkbook.Sheets as Interop.Sheets;
  xlNewSheet = (Microsoft.Office.Tools.Excel.Worksheet)xlSheets.Add(xlSheets[1], Type.Missing, Type.Missing, Type.Missing);
  xlNewSheet.Name = "SheetName1";
  </code></pre>
  
  <p>Is this possible if not, what other options can I take that since the excel sheet is already created using the interop class and </p>