Chapter 7. Building an Excel Add-In

In This Chapter

  • Using VSTO to create new functionality in Excel

  • Creating a dialog box

  • Using and accessing worksheet and workbook properties

An add-in that lives inside the Excel application is just a little bit different from an add-in that lives inside Word, Outlook, or any other Office application VSTO supports. The concept of an add-in in Excel is the same as described in Chapter 2. The only difference is the application that hosts the add-in.

Because the concept of Excel worksheets differs from Word documents, in this chapter, we create a sample that is specific to Excel. (If you want to find out more information about add-ins, refer to Chapter 2.)

Creating a New Project

When you create a new Word document, you have only one design surface in front of you — and that design surface is your Word document. The Excel equivalent of a Word document is an Excel workbook. Excel workbooks can have multiple worksheets.

To create an Excel 2010 add-in:

  1. In Visual Studio 2010, choose File

    Creating a New Project
    Creating a New Project

    The New Project dialog box appears.

  2. Expand the Visual Basic node and the Office node.

    Subfolders for Office 2007 and Office 2010 projects appear.

  3. Click the 2010 subfolder and then click Excel 2010 Add-in.

  4. Type MyFirstExcelAddin in the Name text box and click OK.

    The Excel 2010 ...

Get VSTO For Dummies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.