Visual Studio Tools for Office and the ActionsPane

If you want to add functionality to a specific Office document a Visual Studio Tools for Office (VSTO) ActionsPane is a very convenient way of doing so if you are a .NET developer.

Each document has a single associated ActionsPane so in this respect it is very different from a custom task pane as you can have multiple task panes. The actions pane is basically a WinForms UserControl, ok with the additional functionality of being able to work with Office, so adding controls is easy. Just like this:

Me.ActionsPane.Controls.Add(New TextBox())

Of course adding separate controls like this is probably not the best way to go. I would suggest designing your UI in one or more UserControls and adding these as it makes the layout so much easier.

When designing you controls you need to keep in mind that an actions pane can be moved and the orientation can change from vertical to horizontal. When this happens the ActionsPane.OrientationChanged event fires so that one is easy to take care of.

Sub OrientationChangedHandler() _

Handles ActionsPane.OrientationChanged


Me.ActionsPane.Orientation = Orientation.Vertical Then


‘ Me.ActionsPane.Orientation = Orientation.Horizontal




One thing I find less than intuitive is showing or hiding the actions pane. I would have expected something like a visible property to do so. Not so as this only makes the contents visible or invisible if the action pane is shown. If the actions pane itself is invisible you need to use the DisplayDocumentActionTaskPane property scoped to the application object. Somewhat confusing and judging from the property name so was the original developer. What am I showing here? An ActionsPane or a TaskPane? Hmm not sure, let’s just put both in the name so everyone will be as confused as I am [:(] O well, except for this inconsistency its really easy to use the ActionsPane [:)]

Sub Button1_Click( _

ByVal sender As System.Object, _

ByVal e As Microsoft.Office.Tools.Ribbon.RibbonControlEventArgs) _

Handles Button1.Click


Globals.ThisWorkbook.Application.DisplayDocumentActionTaskPane = True



Did I mention you can even add WPF content to an actions pane? Hmm guess I forgot to say you can. Just make sure you wrap it in a System.Windows.Forms.Integration.ElementHost control.


One thought on “Visual Studio Tools for Office and the ActionsPane

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>