Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

How to: Add an Actions Pane to Excel Workbooks

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

    -or-

    Visual Studio Team System

  • Microsoft Office 2003

The ActionsPane object is available to your Microsoft Visual Studio 2005 Tools for the Microsoft Office System projects, but it is not visible until you add a Windows Forms control to it. You can program against events in the workbook to show and hide controls on the actions pane. You can also program against the events of the controls on the actions pane to perform actions within the workbook.

To add an actions pane to a Microsoft Office Excel 2003 workbook, you can create a user control and then add it to the actions pane. The Add New Item dialog box contains an actions pane control that is a user control for the actions pane; you can use this control or a user control with equal results. For information on how to add an actions pane to Microsoft Office Word 2003 documents, see How to: Add an Actions Pane to Word Documents.

NoteNote

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, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

Creating the Actions Pane Control

To add an actions pane control to your project

  1. Open your Excel project in Visual Studio.

  2. On the Project menu, click Add New Item.

  3. In the Add New Item dialog box, select Actions Pane Control, name it HelloControl, and click Add.

  4. If the actions pane control is not visible in the designer, double click HelloControl in the designer.

  5. From the Windows Forms tab of the Toolbox, select a Button control and drag it to the actions pane control.

  6. Add the following code to the Click event handler of the button.

    private void button1_Click(object sender, System.EventArgs e)
    {
        Globals.Sheet1.Range["A1", System.Type.Missing].Value2 = "Hello World!";
    }
    
    
  7. In C#, you must create an event handler for the Button. You can place this code in the HelloControl constructor as shown below. For more information on creating event handlers, see How to: Create Event Handlers in Visual Studio Tools for Office.

    public HelloControl()
    {
        InitializeComponent();
        this.button1.Click += new System.EventHandler(this.button1_Click);
    }
    
    

Adding the Actions Pane Control to the Actions Pane

In order to show the actions pane, you must first add controls to it. The following example adds an actions pane control to the actions pane in Excel.

To add an actions pane control to the actions pane

  1. Create a new instance of the actions pane control in the ThisWorkbook class:

    private HelloControl hello = new HelloControl();
    
    
  2. Add the following code to the Startup event handler of ThisWorkbook:

    this.ActionsPane.Controls.Add(hello);
    
    

See Also

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft