Workbook Host Item
Updated: July 2008
The information in this topic applies only to the specified Visual Studio Tools for Office projects and versions of Microsoft Office.
For more information, see Features Available by Application and Project Type.
The Workbook host item is a workbook object that exposes events and acts as a container for components.
When you create a document-level customization for Microsoft Office Excel, Visual Studio Tools for Office automatically creates a Workbook host item within the project. You reference the Workbook using ThisWorkbook.
Starting in Visual Studio 2008 Service Pack 1 (SP1), you can get a Workbook host item in an application-level add-in project by calling the GetVstoObject method of a Workbook object. For more information, see Extending Word Documents and Excel Workbooks in Application-Level Add-ins at Run Time.
The Workbook host item does not act as a container for host controls. Therefore, you cannot add any visible controls to the workbook, but you can add components, such as a DataSet, so that the components can be shared by all worksheets. In a document-level project, components available to the workbook can be found on the Component tab, Data tab, and All Windows Forms tab of the Toolbox.
Double-click the ThisWorkbook project item in Solution Explorer to display the workbook designer and to view the properties and events of the workbook in the Properties window.
Visual Studio Tools for Office does not support shared workbooks.
The following events are available for the Workbook host item: