Lesson 5Object-Oriented Programming: An Overview

In Lesson 1, you saw a brief historical synopsis of VBA. One particular facet of VBA's evolution that is worth more explanation is object-oriented programming, or OOP.

Object-oriented programming came about in the 1980s as a new concept in computer programming. Its popularity grew over time and with good reason—OOP's original precepts are at the core of today's VBA programming language for Excel.

What “Object-Oriented Programming” Means

Visual Basic for Applications is an object-oriented programming language. The basic concept of object-oriented programming is that a software application (Excel in this case) consists of various individual objects, each of which has its own set of features and uses. An Excel application contains cells, worksheets, charts, pivot tables, drawing shapes—the list of Excel's objects is seemingly endless. Each object has its own set of features, which are called properties, and its own set of uses, called methods.

You can think of this concept just as you would the objects you encounter every day, such as your computer, your car, or the refrigerator in your kitchen. Each of those objects has identifying qualities, such as height, weight, and color. They each have their own distinct uses, such as your computer for working with Excel, your car to transport you over long distances, and your refrigerator to keep your perishable foods cold.

VBA objects also have their identifiable properties and methods ...

Get Excel VBA 24-Hour Trainer, 2nd Edition 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.