Chapter 7. Using Class Modules to Create Objects

Class modules are used to create objects. There are many reasons for you as a developer to create your own objects, including the following:

  • To encapsulate VBA and Windows API code to make it transportable and easy to use and reuse, as shown in Chapter 9 — Understanding and Using Windows API Calls

  • To trap events

  • To raise events

  • To create your own objects and object models

In this chapter we assume you are already familiar with writing VBA code to manipulate the objects in Excel and are familiar with the Excel object model that defines the relationships among those objects. We also assume you are familiar with object properties, methods and events. If you have written code in the ThisWorkbook module, ...

Get Professional Excel Development: The Definitive Guide to Developing Applications Using Microsoft® Excel and VBA® now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.