Getting Started Programming Document-Level Customizations for Excel
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Getting Started Programming Document-Level Customizations for Excel

Note Required applications

The features in this topic are available only if you have the required applications installed.

For more information, see Features Available by Product Combination.

  • One of these development environments:

    VSTO 2005


    Visual Studio Team System

  • Microsoft Office 2003

If you are just getting started creating document-level customizations for Microsoft Office Excel 2003 by using Microsoft Visual Studio 2005 Tools for the Microsoft Office System, here is what you need to know.

The Single Document Application Model

Each Excel customization you create by using Visual Studio Tools for Office 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. For more information, see Architecture of Visual Studio Tools for Office Solutions.

Using Host Controls

There are new controls available that enable you to program directly against named cell ranges and list objects the same way you program against controls on Windows Forms. These objects, called host controls, are based on native Excel objects, but they are extended with new events and data binding capability. They appear as first-class objects in the programming model and in IntelliSense, which makes it easier to refer to specific cells directly in your code without having to walk through the Excel object model.

Ranges and list objects are available on the Excel Controls tab of the Toolbox in Visual Studio (they are called NamedRange and ListObject), and you can also add them to a worksheet the same way you do when you work with Excel by itself. For more information, see Excel Host Controls.

Using Data Binding

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 objects in your worksheet. For more information, see Connecting to Data.

Next Steps

For a list of topics that walk you through some of the common tasks in Excel automation, see Common Tasks in Office Programming.

See Also

© 2015 Microsoft