Chapter 12. Creating Classes in VBA

The ability 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 like SmallTalk, C++, and later, Java, OOP earned its place in the software hall of fame as the new panacea to all our programming ills. When Visual Basic 4.0 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 ability 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.

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

Get Access 2003 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.