private void deburn(Office.CommandBarButton b, ref bool a, Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler e) { a = true; bool l = true; int i = 100; while (l && i > 1) { try { b.Click -= e; i--; } catch { l = false; } } try { b.Delete(); } catch { } }
/// <summary> /// Delete menu /// </summary> /// <param name="a">the menu to be deleted</param> private void DelPopup(Office.CommandBarPopup a) { foreach (Office.CommandBarButton b in a.Controls) b.Delete(); foreach (Office.CommandBarPopup po in a.Controls) DelPopup(po); a.Delete(); }