|
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Xml.Linq;
- using Excel = Microsoft.Office.Interop.Excel;
- using Office = Microsoft.Office.Core;
- using Microsoft.Office.Tools.Excel;
- using System.Windows.Forms;
- namespace ExcelAddIn1
- {
- public partial class ThisAddIn
- {
- public Excel.Application ExcelApp;
- private void ThisAddIn_Startup(object sender, System.EventArgs e)
- {
- MessageBox.Show("欢迎使用Microsoft Excel");
- ExcelApp =Globals.ThisAddIn.Application;
- ExcelApp.ActiveCell.Value = "first";
- }
- private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
- {
- MessageBox.Show("谢谢使用!");
- }
- #region VSTO 生成的代码
- /// <summary>
- /// 设计器支持所需的方法 - 不要修改
- /// 使用代码编辑器修改此方法的内容。
- /// </summary>
- private void InternalStartup()
- {
- this.Startup += new System.EventHandler(ThisAddIn_Startup);
- this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
- }
-
- #endregion
- }
- }
复制代码
ExcelApp.ActiveCell.Value = "first";这条代码总是出错,因为找不到单元格对象。请问为什么我调试打开excel只有application,但excel2010好的呢?
|
|