How to: Add a Custom Task Pane to an Application
You can add a custom task pane to the applications listed above by using an application-level add-in. For more information, see Custom Task Panes Overview.
Applies to: The information in this topic applies to application-level projects for the following applications: Excel 2007 and Excel 2010; InfoPath 2007 and InfoPath 2010; Outlook 2007 and Outlook 2010; PowerPoint 2007 and PowerPoint 2010; Word 2007 and Word 2010. For more information, see Features Available by Office Application and Project Type.
Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Working with Settings.
To add a custom task pane to an application
Open or create an application-level project for one of the applications listed above. For more information, see How to: Create Office Projects in Visual Studio.
On the Project menu, click Add User Control.
In the Add New Item dialog box, change the name of the new user control to MyUserControl, and then click Add.
The user control opens in the designer.
Add one or more Windows Forms controls from the Toolbox to the user control.
Open the ThisAddIn.cs or ThisAddIn.vb code file.
Add the following code to the ThisAddIn class. This code declares instances of MyUserControl and CustomTaskPane as members of the ThisAddIn class.
Add the following code to the ThisAddIn_Startup event handler. This code creates a new CustomTaskPane by adding the MyUserControl object to the CustomTaskPanes collection. The code also displays the task pane.
This code associates your custom task pane with the active window in the application. For some applications, you might want to modify this code to ensure that the task pane appears with other documents or items in the application. For more information, see Managing Custom Task Panes in Multiple Application Windows.