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 application-level projects for Excel 2013 and Excel 2010. For more information, see Features Available by Office Application and Project Type.

Host items and host controls are available in both application-level add-ins 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:

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft