I have a Word 2007 Document project created with VSTO 3.0 and VS 2008. My requirement is to add an ActiveX Button
to the word document and handle the event for the added button.
I've created the button in the Document with below code:
private void createOLEControl()
{
object objbutton = "Forms.CommandButton.1";
object objMissing = System.Type.Missing;
Word.Shape Text;
Text = this.Application.ActiveDocument.Shapes.AddOLEControl(ref objbutton, ref objMissing, ref objMissing, ref objMissing, ref objMissing, ref objMissing);
Text.OLEFormat.Object.GetType().InvokeMember("Name", System.Reflection.BindingFlags.SetProperty, null, Text.OLEFormat.Object, new object[] { "Click" });
}
But I would like to know how to handle the click event for this CommandButton,
It would be great if you could give me sample C# code to handle "Click" event.