[英]Example of VSTO for Excel in C# for setting up and using the Worksheet Change Event?
我正在尝试为private void ThisAddIn_Startup(object sender, System.EventArgs e)
方法中的工作表Change事件连接事件处理程序。
如果我接受使用Tab键添加的条目,则将以下行添加到private void ThisAddIn_Startup(object sender, System.EventArgs e)
:
activeWorksheet.Change += ActiveWorksheet_Change;
并添加以下方法:
private void ActiveWorksheet_Change(Excel.Range Target)
{
}
编译但在以下位置引发异常:
activeWorksheet.Change += ActiveWorksheet_Change;
是否有关于使用VSTO和C#将事件与Excel加载项一起使用的示例的参考?
最近有关于使用VSTO和C#的书籍吗?
使用以下代码:
this.Application.SheetChange += Application_SheetChange;
private void Application_SheetChange(object Sh, Excel.Range Target)
{
// your code here
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.