我正在尝试捕获在工作簿中创建现有工作表的副本时触发的事件。我的目的是检查工作簿中存在多少份工作表,从而限制副本数量。
答案 0 :(得分:0)
没有Sheet的Add事件。您需要使用Application.SheetActivate
或Workbook.SheetActivate
或Worksheet.Activate
事件。这是一个C#示例
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
this.Application.SheetActivate +=
new Excel.AppEvents_SheetActivateEventHandler(
Application_SheetActivate);
}
void Application_SheetActivate(object Sh)
{
// Your code here to check if the copy is a duplicate or not
}