Inserting a Class Module

From the VBE, select Insert, Class Module. A new module, Class1, is added to the VBAProject Workbook and can be seen in the Project Explorer window (see Figure 20.1). Two things to keep in mind concerning class modules:

■ Each custom object must have its own module. (Event trapping can share a module.)

■ The class module should be renamed to reflect the custom object.

Inserting a Class Module 415

Trapping Application and Embedded Chart Events 416

Creating a Custom Object 420

Using a Custom Object 421

Using Property Let and Property Get to Control How Users Utilize Custom Objects 422

Collections 424

Case Study: Help Buttons 427

User-Defined Types (UDTs) 429

Next Steps 432

Figure 20.1

Custom objects are created in class modules.

Project ■ VliAI' or. l

0 0

Post a comment