private void InternalStartup() { this.ActivateEvent += new Microsoft.Office.Interop.Excel.WorkbookEvents_ActivateEventHandler(ThisWorkbook_ActivateEvent); this.SheetActivate += new Microsoft.Office.Interop.Excel.WorkbookEvents_SheetActivateEventHandler(ThisWorkbook_SheetActivate); this.Startup += new System.EventHandler(ThisWorkbook_Startup); this.Shutdown += new System.EventHandler(ThisWorkbook_Shutdown); } void ThisWorkbook_ActivateEvent() { Excel.Worksheet sh = ActiveSheet as Excel.Worksheet; sh.BeforeRightClick += new Microsoft.Office.Interop.Excel.DocEvents_BeforeRightClickEventHandler(sh_BeforeRightClick); } void ThisWorkbook_SheetActivate(object Sh) { Excel.Worksheet sh = ActiveSheet as Excel.Worksheet; sh.BeforeRightClick += new Microsoft.Office.Interop.Excel.DocEvents_BeforeRightClickEventHandler(sh_BeforeRightClick); } void sh_BeforeRightClick(Microsoft.Office.Interop.Excel.Range Target, ref bool Cancel) { Cancel = true; }