Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

How to: Add a Custom Task Pane to an Application

Note Required applications

The features in this topic are available only if you have the required applications installed.

For more information, see Features Available by Product Combination.

  • One of these development environments:

    VSTO 2005


    Visual Studio Team System


    Visual Studio 2005 Professional Edition

  • VSTO 2005 SE installed in the development environment

  • 2007 Microsoft Office system

You can add a custom task pane to some applications in the 2007 Microsoft Office system by using an application-level add-in. For more information, see Custom Task Panes Overview.


The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, select Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

Adding a Custom Task Pane to an Application

To add a custom task pane to an application

  1. Open or create an application-level project for an application in the 2007 Microsoft Office system. For more information, see How to: Create Visual Studio Tools for Office Projects.


    Microsoft Office Visio 2007 does not support custom task panes. For more information, see Custom Task Panes Overview.

  2. On the Project menu, click Add User Control.

  3. In the Add New Item dialog box, change the name of the new user control to MyUserControl, and click Add.

    The user control opens in the designer.

  4. Drag one or more Windows Forms controls from the Toolbox to the user control.

  5. Open the ThisAddIn.cs or ThisAddIn.vb code file.

  6. Add the following code to the ThisAddIn class. This code declares an instance of MyUserControl as a member of ThisAddIn.

    private MyUserControl myUserControl1;
  7. Add the following code to the ThisAddIn_Startup event handler. This code adds the MyUserControl object to the CustomTaskPanes collection and displays the custom task pane.

    myUserControl1 = new MyUserControl();
    Microsoft.Office.Tools.CustomTaskPane myCustomTaskPane =
        this.CustomTaskPanes.Add(myUserControl1, "My Task Pane");
    myCustomTaskPane.Visible = true;

See Also

Community Additions

© 2015 Microsoft