Chapter 3
The Anatomy of Macros
IN THIS CHAPTER
Understanding the Excel object model
Understanding variables
Understanding event procedures
Handling errors in a nutshell
The engine behind macros is Visual Basic for Applications (VBA). When you record a macro, Excel is busy writing the associated VBA behind the scenes. To fully understand macros, it’s important to understand the underlying VBA typically used in Excel macros.
This chapter starts you on that journey by giving you a primer on some of the objects, variables, events, and error handlers you encounter in macros.
A Brief Overview of the Excel Object Model
VBA 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 characteristics and uses. An Excel application contains workbooks, worksheets, cells, charts, PivotTables, drawing shapes — the list of Excel's objects is seemingly endless. Each object has its own set of characteristics, which are called properties