Runtime Services Sample
Note
This sample runs only in Microsoft Office Excel 2007.
This sample demonstrates how to create a Ribbon customization and a custom task pane for Microsoft Office Excel 2007 by implementing extensibility interfaces in an add-in.
This sample implements the following extensibility interfaces to create the custom task pane:
Microsoft.Office.Core.ICustomTaskPaneConsumer. The sample implements this interface to create a task pane that contains a text box and a button. When the user clicks the button, the string in the text box is added to the range that has focus in the active workbook.
Microsoft.Office.Core.IRibbonExtensibility. The sample implements this interface to add a toggle button that the user can click to display or hide the task pane.
Note
Although this sample uses extensibility interfaces to create a Ribbon customization and a custom task pane, Visual Studio Tools for Office provides classes and designers that you can use instead. These classes and designers simplify the process of working with these features. For more information, see Ribbon Designer and Custom Task Panes Overview.
Security Note: |
---|
This sample code is intended to illustrate a concept, and it shows only the code that is relevant to that concept. It may not meet the security requirements for a specific environment, and it should not be used exactly as shown. We recommend that you add security and error-handling code to make your projects more secure and robust. Microsoft provides this sample code "AS IS" with no warranties. |
To run this sample
Press F5.
On the Ribbon, click the RuntimeServices tab.
In the VSTO group, click the TaskPane button.
Verify that the Contoso task pane appears.
In the task pane, type some text in the text box.
Click the Insert button.
Verify that the text that you typed in the text box is added to the cell that has focus in the active worksheet.
On the Ribbon, click the TaskPane button again.
Verify that the task pane closes.
Requirements
This sample requires the following applications:
Visual Studio Tools for Office.
Microsoft Office Excel 2007.
Demonstrates
This sample demonstrates the following concepts:
Creating a Ribbon customization by implementing the Microsoft.Office.Core.IRibbonExtensibility interface in an add-in.
Creating a custom task pane by implementing the Microsoft.Office.Core.ICustomTaskPaneConsumer interface in an add-in.
Displaying and hiding the custom task pane from a toggle button on the Ribbon.
Inserting text entered in the custom task pane into the active worksheet.
See Also
Tasks
Concepts
Customizing UI Features By Using Extensibility Interfaces