The type or namespace name 'Excel' could not be found

Hello,

I am trying to create a simple program that will open an excel worksheet and do some comparisons.

I can not seem to get VS to recognize Excel.  I have added the Microsoft Excel 11 object library as a reference.  I have also tried "using Excel".  Everytime I put Excel in the code I get an unrecognized namespace error (Note: if I put using Excel in the code, the first compile error is at the using statement - not later in the code).

Am I missing a step

Thanks
Wade.


Answer this question

The type or namespace name 'Excel' could not be found

  • Graham H

    Hi Wade,

    Go through the following KB Article:
    How To Automate Microsoft Excel from Microsoft Visual C# .NET

    Regards,
    Vikram

  • not-bob

    Hi Wade

    yes the problem is with your using statement only.

    I guess for using Excel object lib. you alredy installed the PIAs. If so, then the refrence will pointing to the GAC and not the local path. So in your using statement you need to give the full path(you can see the path thru the property of the added Excel reference in the VS)

    Or You can use like
    using Excel = Microsoft.Office.Interop.Excel

    any have you need to refer it thru Microsoft.Office.Interop.Excel

  • The type or namespace name 'Excel' could not be found