Understanding Object Binding in VBA
(Page 1 of 4 )
Microsoft’s Office products allow you to create powerful macros using Visual Basic for Applications (VBA) in an object-oriented environment. Much of the power presented by VBA is in its ability to use third-party and COM objects to expand upon the codebase that the environment presents. Unfortunately, this is also a common point of confusion for many VBA developers. Today I’m going to give a little “object lesson” to better help you understand how objects work and the different ways of implementing them in your code.
Before we begin, there are a few concepts that you need to understand. Objects are nothing more than external code classes that can be made available for extending your own application. For example, if I were writing a simple calculator application, I might use a third-party math object that contained common mathematical operations. Making use of this pre-written object would prevent me from having to create all of those math functions myself, allowing me to develop my application much more quickly.
From a programming standpoint, objects represent code classes. A class is simply a group of related properties, methods, and events that are often reusable in other, future applications. In the past, developers would have to save these classes and maintain their own libraries, where they could cut and paste code they had written in the past into a new application. As application development evolved over time, this process was simplified into a public system known as the Component Object Model, or COM.
The Component Object Model provided a means for developers to create and share reusable objects, or code classes. The most common of these COM objects are code pieces used by the Windows operating system that Microsoft has made available to programmers developing software for the Windows platform. However, many third-party software packages will also install COM objects that other developers may build their own applications around.
Next: Early Binding >>
More Visual Basic.NET Articles
More By Nilpo