How to: Add an Actions Pane to Word Documents
To add an actions pane to a Microsoft Office Word document, first create a Windows Forms user control. Then, add the user control to the Controls property of the ThisDocument.ActionsPane field in your project.
Applies to: The information in this topic applies to document-level projects for 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.
The following procedure shows how to create user control in a Word project. It also adds a button to the user control that writes text to the document when it is clicked.
To create the user control
Open your Word document or template project in Visual Studio.
On the Project menu, click Add New Item.
In the Add New Item dialog box, select Actions Pane Control, name it HelloControl, and click Add.
You can alternatively add a User Control item to your project. The classes generated by the Actions Pane Control and User Control items are functionally equivalent.
From the Windows Forms tab of the Toolbox, drag a Button control onto the control.
If the control is not visible in the designer, double click HelloControl in Solution Explorer.
Add the following code to the Click event handler of the button.
In C#, you must add an event handler for the button click. You can place this code in the HelloControl constructor after the call to IntializeComponent.
For information about how to create event handlers, see How to: Create Event Handlers in Office Projects.
To show the actions pane, add the user control to the Controls property of the ThisDocument.ActionsPane field.
To add the user control to the actions pane
Add the following code to the ThisDocument class as a class-level declaration (do not add this code to a method).
Add the following code to the ThisDocument_Startup event handler of the ThisDocument class.