Chapter 5. Program Excel with .NET

Visual Basic .NET (VB.NET) is Microsoft’s next generation of the Basic language. The name change marks another milestone in the evolution of Basic: BASICA, QuickBasic, Visual Basic (VBA), and VB.NET each mark distinct changes in underlying technology. This latest change marks the graduation from the Windows Common Object Model (COM) in VBA to the .NET Framework in VB.NET.

The .NET Framework solves a lot of the shortcomings in COM—it has a more complete security model; provides a well-organized library of objects for working with HTTP, XML, SOAP, encryption, and other things; is fundamentally object-oriented; protects against memory leaks and corruption; promotes self-describing code—gosh, I’m starting to sound like a commercial—in short, .NET is the future for programming Windows.

Now the bad news: Excel is (and probably always will be) a COM application. This means that you have to take special steps if you want to use .NET components from Excel or if you want to program Excel from VB.NET.

But back to the good news: Microsoft provides many tools for making the transition between COM and .NET as easy as possible. In this chapter you will learn how to use those tools both to take advantage of .NET from Excel and vice versa.

Work with .NET

There are three main approaches to using .NET with Excel. You can use .NET to create:

  • Components that can be used from Excel macros. This approach works with all Excel versions and is much the same as ...

Get Excel 2003 Programming: A Developer's Notebook now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.