Jerry Nixon @Work: Use VSTO 3 to add an Action Pane to an Excel 2007 Workbook

Jerry Nixon on Windows

Wednesday, November 19, 2008

Use VSTO 3 to add an Action Pane to an Excel 2007 Workbook

This is too easy.

The Action Pane, sometimes called "Document Actions" (The unchangeable title of the actual window in Office), or the Right Panel, is just a User Control inside a docked window. You can use a WPF User Control or a WinForm User Control. You can use custom controls, third party controls, or anything you want.
 

<opinion>
If you choose to create applications in Office, good for you. A compelling reason is users understand Office and how to use it. Don't go putting things in places like the Action Pane which break the Office paradigm. If you do, you lose one major advantage of Office.
</opinion>

 
I have a User Control (in my sample) called UserControl1. Here's how to add it to the Action Pane area:
 

// create action pane

ActionPanel1 _Control;
_Control = new ActionPanel1();
Globals.ThisWorkbook.ActionsPane.Controls.Add(_Control);
_Control.Dock = System.Windows.Forms.DockStyle.Fill;
Globals.ThisWorkbook.ActionsPane.Visible = true;