Why Create Classes?
Some readers may be wondering why they should go to the trouble of creating custom classes. It's true that there is nothing a class can do that could not also be done in “regular” VBA code without a class. The major advantage of classes comes in the areas of programming ease and reusability. Once you have created the class, you can use it in your program—and reuse it in other programs—much more easily than if you had implemented the same functionality outside of a class. This is called encapsulation, meaning that all the functionality related to a specific program task is contained within the class. Letting others use your code is a lot easier with classes too.
Do these advantages outweigh the extra work involved in creating ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access