Getting Started Programming Document-Level Customizations for Excel
If you are just getting started creating document-level customizations for Microsoft Office Excel by using Visual Studio, here is what you need to know.
Applies to: The information in this topic applies to document-level projects for Excel. For more information, see Features Available by Office Application and Project Type.
A document-level customization for Excel is based around a single workbook. To start using the customization, the end user opens the workbook or creates the workbook from an Excel template. Events in the workbook, for example typing in cells or clicking buttons and menu items, can call event-handling methods in the assembly. When the workbook is closed, the features provided by the customization are no longer available in Excel, only in the document that contained them.
For more information, see Architecture of Document-Level Customizations.
To create a document-level customization for Excel, use the Excel Workbook or Excel Template project template in the New Project dialog box. These templates include required assembly references and project files.
For more information about how to create a document-level project for Excel, see How to: Create Office Projects in Visual Studio. For more information about the project templates, see Office Project Templates Overview.
Host items and host controls are classes that provide the programming model for document-level customizations created by using Visual Studio.
Host items provide an entry point for your code, and they can also act as containers for host controls and Windows Forms controls. In document-level projects for Excel, these host items are represented by the
Host controls are based on native Excel objects, such as list objects and ranges. Host controls provide similar functionality to the native Excel objects, but they also have new events, designer support, and data binding capability. They appear as first-class objects in your project code and in IntelliSense, which makes it easier to refer to specific objects directly in your code without having to navigate the Excel object model.
For more information, see the following topics:
Most Microsoft Office solutions modify the user interface (UI) of the Office application to provide some way for users to interact with the solution. There are many ways in which you can modify the UI of Excel by using a document-level customization. For example, you can add controls to the ribbon, or you can display an actions pane. For more information, see Office UI Customization.
You can also open the workbook that is associated with your project directly in Visual Studio. When the workbook is open in Visual Studio, you can modify the workbook by using the Excel user interface. You can also use the workbook as a design surface, which enables you to drag controls onto worksheets. For more information, see Office Projects in the Visual Studio Environment.
The host controls are also in the list of controls that you can drag from the Data Sources window. Adding host controls in this way automatically binds them to the data source that you set up using the window. Without writing any code, you can display data from databases, web services, and business objects. For more information, see Binding Data to Controls in Office Solutions.
To learn how to create a document-level customization for Excel, see Walkthrough: Creating Your First Document-Level Customization for Excel. This walkthrough introduces you to the Office development tools in Visual Studio and the programming model for Excel document-level customizations.
For a list of topics that walk you through some of the common tasks in Excel projects, see Common Tasks in Office Programming.
How to: Create Office Projects in Visual Studio
Programming Document-Level Customizations
Walkthrough: Creating Your First Document-Level Customization for Excel
Walkthroughs Using Excel
Excel Object Model Overview
Writing Code in Office Solutions