这样的一段代码:
--------------------------------------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
Excel.Application MyExcelApp = new Excel.ApplicationClass(); public Form1()
{
InitializeComponent();
} private void Form1_Load(object sender, EventArgs e)
{ }
}
}
--------------------------------------------------------
添加excel的com对象Microsoft Excel 11.0 Object后,在VS2008中/英文版和VS2005中文版中提示如下错误:“错误1 找不到类型或命名空间名称“Excel”(是否缺少 using 指令或程序集引用?)”。而在VS2008中文速成版里则可以正常运行,散分求助!
--------------------------------------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
Excel.Application MyExcelApp = new Excel.ApplicationClass(); public Form1()
{
InitializeComponent();
} private void Form1_Load(object sender, EventArgs e)
{ }
}
}
--------------------------------------------------------
添加excel的com对象Microsoft Excel 11.0 Object后,在VS2008中/英文版和VS2005中文版中提示如下错误:“错误1 找不到类型或命名空间名称“Excel”(是否缺少 using 指令或程序集引用?)”。而在VS2008中文速成版里则可以正常运行,散分求助!
using Excel = Microsoft.Office.Interop.Excel;参考
http://blog.csdn.net/net_lover/archive/2007/07/23/1702797.aspx
但不知为什么在正式版里需要加“using Excel = Microsoft.Office.Interop.Excel; ”而速成版则不用呢?为什么呢?
1、在添加了Microsoft Excel 11.0 Object,后,引用中多了2项:Microsoft.Office.Core 和 Excel;
2、加上【Excel.Application MyExcelApp = new Excel.ApplicationClass(); 】,编译;
3、通过,没有错误。