Skip to Main Content
Excel 2003 Programming: A Developer's Notebook
book

Excel 2003 Programming: A Developer's Notebook

by Jeff Webb
August 2004
Intermediate to advanced content levelIntermediate to advanced
312 pages
8h 30m
English
O'Reilly Media, Inc.
Content preview from Excel 2003 Programming: A Developer's Notebook

Create .NET Components

If you are an experienced VBA programmer, this is a great way to start learning .NET because you can take advantage of features built in to the .NET Framework in small, incremental steps.

Note

You can use .NET components from any VBA application. There are no version restrictions and no prerequisites other than the .NET Framework.

How to do it

To create a .NET component for use in Excel:

  1. From within Visual Studio .NET, create a new Class Library project using VB.NET or C#. Visual Studio creates a folder and template files for the project as shown in Figure 5-1.

    A new, empty .NET class library project

    Figure 5-1. A new, empty .NET class library project

  2. From the Project menu, choose Add Class. Visual Studio displays the Add Project Item dialog box, as shown in Figure 5-2.

    Create a new COM class to contain components for use from Excel

    Figure 5-2. Create a new COM class to contain components for use from Excel

  3. Give the new class a descriptive name and click OK. Visual Studio registers the project to interoperate with COM (the Register for COM Interop selection on the Project Options, Build dialog box) and creates a new, empty code template for your class, as shown in Figure 5-3.

  4. Add code to the class library for the objects, properties, and methods you want to use from Excel.

  5. Compile the project by selecting Build Solution from the Build menu. Visual Studio ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Microsoft® Office Excel 2003 Programming Inside Out

Microsoft® Office Excel 2003 Programming Inside Out

Curtis Frye, Wayne S. Freeze, Felicia K. Buckingham
Excel® 2007 VBA Programmer's Reference

Excel® 2007 VBA Programmer's Reference

John Green, Stephen Bullen, Rob Bovey, Michael Alexander
Office 2003 XML

Office 2003 XML

Simon St. Laurent, Mary McRae, Evan Lenz

Publisher Resources

ISBN: 0596007671Supplemental ContentCatalog PageErrata