Chapter 13. Creating Classes in VBA

The capability to create self-contained software objects was first conceived in about 1970 with the development of SIMULA 67 (SIMUlation LAnguage), an extension of the scientific ALGOL 60 computer language.

It took quite a while before the programming community realized the implications of the breakthrough that SIMULA represented. When they did, object-oriented programming (OOP) quickly became the new buzzword, relegating structured programming to the realm of the lesser-informed code cutters.

With the release of languages such as SmallTalk, C++ and, later, Java, OOP earned its place in the software hall of fame as the new panacea to all your programming ills. When Visual Basic 4 was released in 1993, Basic developers were tantalized by a new toy: the class module.

Long snubbed by C++ developers who had been using class modules for years, Basic developers were finally able to hold their heads high with the new found capability to create fully self-contained and reusable objects.

In OOP parlance, an object is a unique instance of a data structure, called a class, that has both properties (which define its characteristics), and executable procedures called methods (which define its behavior in modifying those properties).

The properties of a class are completely isolated from the outside world and can be modified internally only by its own methods. This doesn't mean that the programmer can't do anything to them, but that he can't do anything to ...

Get Access™ 2007 VBA Programmer's Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.