Reputation: 1174
I am attempting to wire-up an event handler for a worksheet Change event in the private void ThisAddIn_Startup(object sender, System.EventArgs e)
method.
If I accept the entry added by using the tab key,the following line is added to private void ThisAddIn_Startup(object sender, System.EventArgs e)
:
activeWorksheet.Change += ActiveWorksheet_Change;
and the following method is added:
private void ActiveWorksheet_Change(Excel.Range Target)
{
}
This compiles but throws an exception at:
activeWorksheet.Change += ActiveWorksheet_Change;
Is there a reference with examples on using events with an Excel Add-in using VSTO and C#?
Are there any recent books on using VSTO and C#?
Upvotes: 0
Views: 732
Reputation: 46
use the following code :
this.Application.SheetChange += Application_SheetChange;
private void Application_SheetChange(object Sh, Excel.Range Target)
{
// your code here
}
Upvotes: 1