Controls and Components (How Do I in Visual Studio Tools for Office)

This page provides links to Help for commonly performed tasks that make use of the controls and components available in Visual Studio Tools for Office. To see other categories of key tasks covered by Visual Studio Tools for Office Help, see How Do I in Visual Studio Tools for Office.

How to: Add Windows Forms Controls to Office Documents

Describes how you can add Windows Forms controls to Excel and Word documents at design time or at run time.

How to: Hide Controls on Worksheets when Printing

Explains how to hide Windows Forms controls so that they do not appear when you print an Excel worksheet.

How to: Resize Controls Within Worksheet Cells

Demonstrates how to set a Windows Forms control to automatically resize when the underlying worksheet cell is resized.

Word Controls Sample

Demonstrates how to access the events of managed controls on a Microsoft Office Word document from a Visual Studio Tools for Office project assembly.

Adding Controls to Office Documents at Run Time

Describes how to programmatically add Windows Forms controls and host controls to documents and worksheets.

How to: Add an Actions Pane to Word Documents

Describes how to create a user control in your Word project and display the control on an actions pane associated with your document.

How to: Add an Actions Pane to Excel Workbooks

Explains how to display an actions pane in an Excel workbook by adding a user control that you create in your project.

Walkthrough: Inserting Text into a Document from an Actions Pane

Steps you through the process of creating an actions pane that populates a Word document with text that the user types in the actions pane.

Walkthrough: Binding Data to Controls on an Excel Actions Pane

Describes how to add controls that are bound to a data source to an actions pane in Excel.

Walkthrough: Binding Data to Controls on a Word Actions Pane

Demonstrates binding data to controls on an actions pane in Word, in which the controls demonstrate a master/detail relation between tables in a SQL Server database.

Walkthrough: Changing the Actions Pane According to User Context

Steps through the process of adding user controls to, and removing user controls from, an actions pane in Word in response to XMLNode events.

How to: Manage Control Layout on Actions Panes

Provides an example that shows how to write code to properly stack user controls on an actions pane if you are using multiple user controls.

Walkthrough: Binding Data to Controls on a Word Actions Pane

Demonstrates binding data to controls on an actions pane in Word, in which the controls demonstrate a master/detail relation between tables in a SQL Server database.

Actions Pane Help Label Sample

Demonstrates a control that displays dynamic, context-sensitive help on an actions pane for a document that contains XML-mapped regions.

Actions Pane Subpane Control Sample

Demonstrates custom user controls on an actions pane, and includes a collapsible container control (the subpane control) that helps you organize controls on an actions pane.

How to: Add a Custom Task Pane to an Application

Describes how to add a user interface panel that is docked to one side of a window in a Microsoft Office application.

How to: Display Custom Task Panes with E-Mail Messages in Outlook

Shows how to display a custom task pane in the Inspector window of every e-mail message that is opened in Outlook.

Walkthrough: Automating an Application from a Custom Task Pane

Shows how to create a custom task pane that automates PowerPoint.

Walkthrough: Synchronizing a Custom Task Pane with a Ribbon Button

Demonstrates how to create a custom task pane that users can hide or display by clicking a toggle button on the Ribbon.

Walkthrough: Displaying Custom Task Panes with E-Mail Messages in Outlook

Demonstrates how to display a unique instance of a custom task pane with each e-mail message that is created or opened.

How to: Resize Controls Within Worksheet Cells

Demonstrates how to set a Windows Forms control to automatically resize when the underlying worksheet cell is resized.

Walkthrough: Changing Document Formatting Using CheckBox Controls

Demonstrates how to use check box controls on a Word document to change text formatting.

Limitations of Windows Forms Controls on Office Documents

Describes the limitations of using Windows Forms controls on a document, including information about unsupported controls, unsupported methods and properties of controls, and the differences that exists when a control is placed on a document versus a Windows Form.

How to: Use Built-In Dialog Boxes in Word

Describes how to use the built-in dialog boxes in Word, which are exposed in the Dialogs collection of the Application object.

How to: Use Word Dialog Boxes in Hidden Mode

Demonstrates how to use the Execute method without calling the Display method to silently invoke the built-in dialog boxes in Word.

How to: Display a Dialog Box to Open Excel Files

Shows how to display the standard Open File dialog box from Excel.

Office UI Customization

Provides an overview of ways that you can customize your Office applications, including adding actions panes, custom Ribbons, menus, and toolbars.

How to: Get Started Customizing the Ribbon

Shows how to add Ribbon items to a Visual Studio Tools for Office project.

Walkthrough: Creating a Custom Tab by Using the Ribbon Designer

Demonstrates how to design a custom tab of an Excel 2007 document-level customization by using the Ribbon Designer.

How to: Create Office Menus Programmatically

Shows how to create a menu that contains one menu command on the menu bar in Excel.

How to: Create Office Toolbars Programmatically

Provides an example that programmatically creates a toolbar that contains two buttons in Word.

How to: Add Chart Controls to Worksheets

Shows the two ways to add Chart controls to your Excel worksheets: by using Excel functionality, and by using code at run time.

How to: Add ListObject Controls to Worksheets

Demonstrates several ways to add ListObject controls to Excel worksheets: by using Excel functionality, by using the Visual Studio Toolbox or the Data Sources window, and by using code at run time.

How to: Resize ListObject Controls

Demonstrates how to change the size of a list in an Excel workbook by redefining its size in the Resize List dialog box, or by resizing it programmatically.

How to: Validate Data When a New Row is Added to a ListObject Control

Describes how to use the BeforeAddDataboundRow event to validate data before committing changes in the list object to the data source.

Understanding ListObject Column and Row Order Persistence

Describes how column and row order changes made to a list object are preserved.

How to: Handle Errors When a New Row is Added to a ListObject Control

Describes how to use the ErrorAddDataboundRow event to correct an error and attempt to add the row to the data source again.

How to: Add NamedRange Controls to Worksheets

Describes several ways to add named ranges to worksheets.

How to: Delete NamedRange Controls at Design Time

Describes how to use the Excel Define Name dialog box to delete NamedRange controls from an Excel worksheet.

How to: Resize NamedRange Controls

Shows how you can resize a named range by either redefining its size in the Define Name dialog box or resizing it programmatically.

Walkthrough: Programming Against Events of a NamedRange Control

Demonstrates how to add a NamedRange control to an Excel worksheet and program against its events.

How to: Locate NamedRange Controls on a Worksheet

Describes how to use the Name box or Properties window to locate NamedRange controls on a worksheet.

How to: Add XMLMappedRange Controls to Worksheets

Demonstrates that mapping an XML element to a cell in Excel causes Visual Studio Tools for Office to automatically add an XMLMappedRange control to the worksheet.

How to: Resize Bookmark Controls

Demonstrates the various ways to resize bookmark controls, including adding text to the bookmark, recreating the bookmark, and setting the start and end properties in the Properties window.

How to: Add Bookmark Controls to Word Documents

Describes several ways to add Bookmark controls.

Walkthrough: Creating Shortcut Menus for Bookmarks

Demonstrates how to write code in the BeforeRightClick event handler of a Bookmark control to display a shortcut menu when the user right-clicks text in a bookmark.

How to: Add XMLNode Controls to Word Documents

Explains that mapping a non-repeating XML schema element to a Word document causes Visual Studio Tools for Office to automatically add an XMLNode control to the document.

How to: Add XMLNodes Controls to Word Documents

Demonstrates that mapping a repeating XML schema element to a Word document causes Visual Studio Tools for Office to automatically add an XMLNodes control to the document.

Walkthrough: Changing the Actions Pane According to User Context

Steps you through the process of adding user controls to, and removing user controls from, an actions pane in Word in response to XMLNode events.

Host Items and Host Controls Overview

Provides information about host controls, which extend native Office objects such as ranges and add additional functionality including events and data-binding capabilities.

Word Host Controls

Provides links to information about adding, removing, and resizing host controls in Word.

Excel Host Controls

Provides links to information about adding, removing, and resizing host controls in Excel.

Programmatic Limitations of Host Items and Host Controls

Describes the limitations of host items and host controls, including information about programmatic creation and conversion between host controls and their underlying native Office objects.

How to: Add Content Controls to Word Documents

Describes how to add a content control to a Word document.

How to: Protect Parts of Documents by Using Content Controls

Describes how to use content controls to prevent users from changing or deleting content in a part of a document.

Walkthrough: Creating a Template By Using Content Controls

Demonstrates how to use content controls to create structured and reusable content in a Word template.

Walkthrough: Binding Content Controls to Custom XML Parts

Demonstrates how to bind content controls in a Word document to XML data that is stored in a document.

Walkthrough: Programming Against Events of a NamedRange Control

Demonstrates how to add a NamedRange control to an Excel worksheet and program against its events.

Walkthrough: Changing Document Formatting Using CheckBox Controls

Demonstrates how to use check box controls on a Word document to change text formatting.

Walkthrough: Changing Worksheet Formatting Using CheckBox Controls

Demonstrates the basics of using check boxes on an Excel worksheet to change formatting.

Walkthrough: Displaying Text in a Text Box in a Document Using a Button

Demonstrates some basic principles of using buttons and text boxes on Word documents.

Walkthrough: Displaying Text in a Text Box in a Worksheet Using a Button

Shows the basics of using buttons and text boxes on Excel worksheets.

Walkthrough: Updating a Chart in a Document Using Radio Buttons

Steps you through the process of using radio buttons on a Word document to change chart styles.

Walkthrough: Updating a Chart in a Worksheet Using Radio Buttons

Shows the basics of changing chart styles using radio buttons on an Excel worksheet.

Walkthrough: Binding Data to Controls on an Excel Actions Pane

Describes how to add controls that are bound to a data source to an actions pane in Excel.

Walkthrough: Creating Shortcut Menus for Bookmarks

Demonstrates how to write code in the BeforeRightClick event handler of a Bookmark control to display a shortcut menu when the user right-clicks text in a bookmark.

Walkthrough: Binding Data to Controls on a Word Actions Pane

Demonstrates binding data to controls on an actions pane in Word in which the controls demonstrate a master/detail relation between tables in a SQL Server database.

How to: Interact with Windows Forms

Demonstrates how to add Windows Forms and other items to your Word and Excel projects just as you do in other projects in Visual Studio.

Walkthrough: Collecting Data Using a Windows Form

Shows how to open a Windows Form from an Excel worksheet, collect information from the user, and write that information into a worksheet cell.

Community Additions

ADD
Show: