//Create callback methods here. For more information about adding callback methods, visit https://go.microsoft.com/fwlink/?LinkID=271226 public void RibbonLoad(Office.IRibbonUI ribbonUI) { this.ribbon = ribbonUI; //register events Application = Globals.ThisAddIn.Application; SelectionChangeEvent = new Microsoft.Office.Interop.Word.ApplicationEvents4_WindowSelectionChangeEventHandler(Application_WindowSelectionChange); Application.WindowSelectionChange += SelectionChangeEvent; DocumentChangeEvent = new Microsoft.Office.Interop.Word.ApplicationEvents4_DocumentChangeEventHandler(Application_DocumentChange); Application.DocumentChange += DocumentChangeEvent; }
public void Ribbon_Load(Office.IRibbonUI ribbonUI) { //hold a handle to the ribbon so we can refresh controls later this.Ribbon = ribbonUI; //register events Application = Globals.ThisAddIn.Application; SelectionChangeEvent = new Microsoft.Office.Interop.Word.ApplicationEvents4_WindowSelectionChangeEventHandler(Application_WindowSelectionChange); Application.WindowSelectionChange += SelectionChangeEvent; DocumentChangeEvent = new Microsoft.Office.Interop.Word.ApplicationEvents4_DocumentChangeEventHandler(Application_DocumentChange); Application.DocumentChange += DocumentChangeEvent; }