Migrate to .NET

If you are an experienced Visual Basic programmer, you’ve got a good start on learning VB.NET. However, there are significant language differences so be prepared for a learning curve and don’t expect to be able to cut and paste code from a VBA project into VB.NET and have the code run.

Note

.NET isn’t an allor- nothing proposition. Most businesses will migrate from COM to .NET over a long period of time. In fact, COM will probably never completely go away. Keep those copies of VB 6.0 around!

Existing VBA code may provide a template for VB.NET code, but VB.NET is really a different language from VBA. There are large as well as subtle differences. If you are new to VB.NET, you will save a great deal of time by buying and reading one of the many books on VB.NET. One of the best, in my opinion, is Programming Microsoft VB.NET Version 2003 by Francesco Balena—a book that I was proud to work on as technical editor.

The following sections list a few recommendations that may make your transition easier.

What you lose: edit and continue

You can’t change code while debugging VB.NET applications and then continue execution using those changes. .NET applications must be recompiled each time they are run. This is cumbersome when loading and unloading especially large applications such as Excel, so it is a good idea to have the basic .NET programming techniques down cold before tackling an Excel .NET project.

A good way to learn .NET programming techniques is to start with ...

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.