HI

I want to read Excel file from C#,below I menation the coding I use,
I add Microsoft Excel 12.0 object library ,but Once I complie the coding it gave me error Meassage.The Error Meassage is
1."Type of Namespace for Application class Doesnt exsits"
2.Excel.Application.Workbook(object) is a method,which not given valid in the given context.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Excel;
namespace ExcelTest2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

            Excel.Application  xl = new Excel.ApplicationClass();

            Excel.Workbook wb = xl.Workbooks.Open("D:\\Test\\Test.xls", 0, false, 5, System.Reflection.Missing.Value, System.Reflection.Missing.Value, false, System.Reflection.Missing.Value, System.Reflection.Missing.Value, true, false, System.Reflection.Missing.Value, false, false, false);

        }
    }
}

HI

I add that reference also but still error meassage is exists
."The type or namespace name 'ApplicationClass' does not exist in the namespace 'Excel' "

Thanks
Tank50

Application not ApplicationClass!
== Microsoft.Office.Interop.Excel.Application xl = new Microsoft.Office.Interop.Excel.Application();

This question has already been answered. Start a new discussion instead.