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 12, “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, VBA, and .NET, Second 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.