Cannot be embbedded. Use the applicable interface instead
<p>I am trying to add a photo to a Excel SpreadSheet but keep getting the following error.</p>

<blockquote>
  <p>Error 1   Interop type 'Microsoft.Office.Interop.Excel.ApplicationClass'
  cannot be embedded. Use the applicable interface instead.</p>
</blockquote>

<p>.ApplicationClass(); is underlined in red in this line of code:</p>

<blockquote>
  <p>xlApp = new Excel.ApplicationClass();</p>
</blockquote>

<p>Could Some on please tel me how i could fix this?</p>

<pre><code>using Excel = Microsoft.Office.Interop.Excel;
using Microsoft.Office.Core;

private void btnWriteSpreedSheet_Click(object sender, EventArgs e)
        {
            Excel.Application xlApp;
            Excel.Workbook xlWorkBook;
            Excel.Worksheet xlWorkSheet;
            object misValue = System.Reflection.Missing.Value;

            xlApp = new Excel.ApplicationClass(); //This is where the problem is??????
            xlWorkBook = xlApp.Workbooks.Add(misValue);
            xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);

            //add some text 
            xlWorkSheet.Cells[1, 1] = "http://csharp.net-informations.com";
            xlWorkSheet.Cells[2, 1] = "Adding picture in Excel File";

            xlWorkSheet.Shapes.AddPicture("C:\\csharp-xl-picture.JPG", Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoCTrue, 50, 50, 300, 45);

              xlWorkBook.SaveAs("csharp.net-informations.xls", Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);
            xlWorkBook.Close(true, misValue, misValue);
            xlApp.Quit();

            releaseObject(xlApp);
            releaseObject(xlWorkBook);
            releaseObject(xlWorkSheet);

            MessageBox.Show ("File created !");
        }

        private void releaseObject(object obj)
        {
            try
            {
                System.Runtime.InteropServices.Marshal.ReleaseComObject(obj);
                obj = null;
            }
            catch (Exception ex)
            {
                obj = null;
                MessageBox.Show("Unable to release the Object " + ex.ToString());
            }
            finally
            {
                GC.Collect();
            }
        } 

    }
</code></pre>
