public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom) { Globals.Application = (Excel.Application)application; Globals.Application.WorkbookNewSheet += new Excel.AppEvents_WorkbookNewSheetEventHandler(NewWorksheetWatcher.NewWorksheet); ((Excel.AppEvents_Event)Globals.Application).NewWorkbook += new Excel.AppEvents_NewWorkbookEventHandler(NewWorkbookWatcher.NewWorkbook); Globals.Application.WorkbookOpen += new Excel.AppEvents_WorkbookOpenEventHandler(WorkbookOpenWatcher.WorkbookOpen); foreach (Excel.Workbook wb in Globals.Application.Workbooks) { NewWorkbookWatcher.NewWorkbook((object)wb); } }
public static void WorkbookOpen(object book) { NewWorkbookWatcher.NewWorkbook(book); }