Automate 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 Worksheet and 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 host items

Excel projects give you access to several host items:

  • Worksheet. This host item contains and 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.

Excel host controls

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: