Object models

The secret to using VBA with other applications lies in understanding the object model for each application. VBA, after all, simply manipulates objects, and each product (Excel, Word, Access, PowerPoint, and so forth) has its own unique object model. You can program an application by using the objects that the application exposes.

Excel's object model, for example, exposes several very powerful data analysis objects, such as worksheets, charts, pivot tables, and numerous mathematical, financial, engineering, and general business functions. With VBA, you can work with these objects and develop automated procedures. While you work with VBA in Excel, you gradually build an understanding of the object model. Warning: It will be very confusing at first. Eventually, however, the pieces come together - and all of a sudden, you realize that you've mastered it!

Is VBA Becoming Obsolete?

For the past few years, I've heard rumors that Microsoft is going to remove VBA from the Office applications and replace it with .NET. My understanding is that these rumors are completely unfounded. Sure, Microsoft has developed another way to automate Office applications, but VBA will be around for quite a while - at least in Excel for Windows. As I write this, Microsoft announced that VBA would no longer be part of Excel for Macintosh.

Why will VBA survive? Because literally millions of VBA-based solutions are in use and VBA is much easier to learn and use than the alternative.

0 0

Post a comment