Workbook Host Item
Applies to |
---|
The information in this topic applies only to the specified Visual Studio Tools for Office projects and versions of Microsoft Office. Document-level projects
Application-level projects
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.
Understanding Workbook Host Items
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.
Note
Visual Studio Tools for Office does not support shared workbooks.
Events
The following events are available for the Workbook host item:
See Also
Tasks
Excel Add-In Dynamic Controls Sample
Concepts
Extending Word Documents and Excel Workbooks in Application-Level Add-ins at Run Time
Host Items and Host Controls Overview
Programmatic Limitations of Host Items and Host Controls
Other Resources
Change History
Date |
History |
Reason |
---|---|---|
July 2008 |
Added information about using workbook host items in application-level add-ins. |
SP1 feature change. |