![]() |
|
#1
|
|||
|
|||
|
Hi,
How do I set up events for Word / C#? That is, something like "display message on double click" is good enough, but I need it to work on any document when this addin is active (not disabled etc.). I use pretty much everywhere else Interop, but if Tools is required, then Tools is ok too. I have a start here: Code:
namespace WordAddIn1
{
public partial class ThisAddIn
{
public event Microsoft.Office.Tools.Word.ClickEventHandler BeforeDoubleClick;
private void DocumentBeforeDoubleClick()
{
Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
vstoDoc.BeforeDoubleClick += new Microsoft.Office.Tools.Word.ClickEventHandler(ThisDocument_BeforeDoubleClick);
}
void ThisDocument_BeforeDoubleClick(object sender, Microsoft.Office.Tools.Word.ClickEventArgs e)
{
Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
System.Windows.Forms.MessageBox.Show(vstoDoc.Name + " was double-clicked.");
}
//and below is then private void ThisAddIn_Startup etc.
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
word 2015 squares and Border problem
|
M.Hat | Word | 8 | 08-07-2018 08:23 AM |
word 2015 menu does not stay open
|
jalea148 | Word | 6 | 03-09-2018 04:46 PM |
| NO contacts after Outlook updated 3-2017 | spockmckoy | Outlook | 0 | 03-08-2017 07:14 AM |
| foto kalender 2017 | Herman Mirte | Publisher | 0 | 12-07-2016 02:26 AM |
Does Word have an "Events log?
|
Balliol | Word | 1 | 05-26-2011 12:57 AM |