The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Automating Excel by Using Extended Objects


When you develop Excel solutions in Visual Studio, you can use host items and host controls in your solutions. These are objects that extend certain commonly used objects in the Excel object model (that is, the object model that is exposed by the primary interop assembly for Excel), such as the Microsoft.Office.Interop.Excel.Worksheet and Microsoft.Office.Interop.Excel.Range objects. The extended objects behave like the Excel objects they are based on, but they add additional features such as new events and data binding capabilities to the objects.

Applies to: The information in this topic applies to document-level projects and VSTO add-in projects for Excel. For more information, see Features Available by Office Application and Project Type.

Host items and host controls are available in both VSTO Add-in and document-level customizations, although the context in which these can be used is different for each type of solution. For more information, see Host Items and Host Controls Overview.

Excel projects give you access to several host items:

  • Worksheet. This host item contains represents a worksheet in your project. It also acts as a container for managed controls, including host controls and Windows Forms controls, and it maintains information about the controls on its surface. For more information, see Worksheet Host Item.

  • Workbook. This host item represents the workbook in your project, and acts as a container for components that are shared by all worksheets in the workbook. For more information, see Workbook Host Item.

  • ChartSheet. This host item a worksheet in Excel that contains only a chart and exposes events.

    When you add a chart sheet at design time as a new sheet in your Microsoft Office Excel document-level customization project, Visual Studio automatically creates a ChartSheet host item.

    Although a ChartSheet host item is a worksheet in Excel, you cannot add any controls to the chart sheet. If you want to have other controls on a worksheet with a chart, do not use a chart sheet. Instead, you can place a chart as an embedded object on a worksheet by using the Chart host control. For more information, see Chart Control.

There are several host controls for Excel that help you create, organize, and automate workbooks and worksheets. These host controls provide events and data-binding capabilities that their counterparts in the native Excel object model do not have.

For more information about the host controls you can use in Excel projects, see the following topics:

How to: Fill ListObject Controls with Data
How to: Add Chart Controls to Worksheets
How to: Add ListObject Controls to Worksheets
How to: Add NamedRange Controls to Worksheets
How to: Add XMLMappedRange Controls to Worksheets
How to: Resize NamedRange Controls
How to: Resize ListObject Controls
How to: Validate Data When a New Row is Added to a ListObject Control
How to: Map ListObject Columns to Data
Walkthrough: Programming Against Events of a NamedRange Control
Extending Word Documents and Excel Workbooks in VSTO Add-ins at Run Time
Controls on Office Documents
Adding Controls to Office Documents at Run Time
Host Items and Host Controls Overview
Programmatic Limitations of Host Items and Host Controls