Microsoft Office Tutorials and References
In Depth Information
Adding controls to menus
6. Expand the toolbox window in Visual Studio 2008, and you can find the
controls that support the Ribbon menu in Office customization.
7. Drag-and-drop the ToggleButton control that's required for the
development, to inside your group control in the Ribbon.
8. Right-click on the control, and then select Properties . In the Properties
window, select the Click event under Events . Following is the code for the
Click event of the ToggleButton in the custom Ribbon.
// Click event of the ToggleButton
private void toggleButton1_Click(object sender,
// Inserting text in the active window using Range Object
Microsoft.Office.Interop.Word.Range rngWordRange =
// Set the text for the text properties
rngWordRange.Text = "Microsoft - VSTO Book \n";