This documentation is archived and is not being maintained.

Getting Started Programming Document-Level Customizations for Excel

Applies to

The information in this topic applies only to the specified Visual Studio Tools for Office projects and versions of Microsoft Office.

Project type

  • Document-level projects

Microsoft Office version

  • Excel 2003

  • Excel 2007

For more information, see Features Available by Application and Project Type.

If you are just getting started creating document-level customizations for Microsoft Office Excel by using Visual Studio Tools for Office, here is what you need to know.

Each Excel customization you create by using Visual Studio Tools for Office is based around a single workbook. To start using the customization, the end user opens the workbook or creates the workbook from an Excel template. Events in the workbook, for example typing in cells or clicking buttons and menu items, can call event-handling methods in the assembly. For more information, see Architecture of Document-Level Customizations.

Host items and host controls are classes that provide the programming model for document-level customizations created by using Visual Studio Tools for Office.

Host items provide an entry point for your code, and they can also act as container for controls such as host controls and Windows Forms controls. Excel customizations use the Microsoft.Office.Tools.Excel.Workbook, Microsoft.Office.Tools.Excel.Worksheet, and Microsoft.Office.Tools.Excel.ChartSheet host items. For more information, see Host Items and Host Controls Overview, Workbook Host Item, Worksheet Host Item, and ChartSheet Host Item.

Host controls are based on native Excel objects, such as list objects and ranges. Host controls provide similar functionality to the native Excel objects, but they also have new events, designer support, and data binding capability. They appear as first-class objects in the Visual Studio Tools for Office programming model and in IntelliSense, which makes it easier to refer to specific objects directly in your code without having to navigate the Excel object model. Ranges and list objects are available on the Excel Controls tab of the Toolbox in Visual Studio (they are called NamedRange and ListObject), and you can also add them to a worksheet the same way you do when you work with Excel by itself. For more information, see Host Items and Host Controls Overview and Excel Host Controls.

The host controls are also in the list of controls that you can drag from the Data Sources window. Adding host controls in this way automatically binds them to the data source that you set up using the window. Without writing any code, you can display data from databases, Web services, and objects in your worksheet. For more information, see Binding Data to Controls in Office Solutions.

Most Microsoft Office solutions modify the user interface (UI) of the Office application to provide some way for users to interact with the solution. There are many ways in which you can modify the UI of Excel by using a document-level customization. For example, you can add controls to the Ribbon, you can display an actions pane, or you can create smart tags that respond to specific strings that users type in a worksheet. For more information, see Office UI Customization.

For a list of topics that walk you through some of the common tasks in Excel automation, see Common Tasks in Office Programming.