Create Excel .NET Applications
A third and final way for Excel and .NET to interact is through the Visual Studio .NET Tools for Office. This set of tools includes Visual Studio .NET project templates for Excel and Word. These project templates allow you to link a specific document to a .NET assembly that loads whenever the user opens that document. The .NET code in the assembly can control Excel and respond to Excel events as described in the preceding sections.
How to do it
To create an Excel application in Visual Studio .NET:
From the Project menu, choose New, Project. Visual Studio .NET displays the New Project dialog box.
Select the Microsoft Office System Projects, Visual Basic Projects project type and Excel Workbook template, give the project a descriptive name and click OK. Visual Studio .NET starts the Microsoft Office Project Wizard to walk you through.
Click Finish to create the project folder and empty workbook and code template files.
Visual Studio .NET doesn’t automatically add the workbook to the project, so it is a good idea to add it at this point. From the Project menu, choose Add Existing Item and then select the .xls file found in the application folder.
Once the workbook is added to the project, select the workbook in the Solution Explorer and set its Build Action property to Content. This will ensure that the workbook is distributed with your application if you create an installation program.
How it works
When Visual Studio .NET creates ...