Class Module Fundamentals

Each class that you create exists in its own class module. To add a new, empty class module to your VBA project, select Class Module from the Insert menu. When the class module is active, its properties will display in the Properties window. There are only two properties. Name is the name of the class, and your first action when creating a new class should be to assign a Name property that describes the function of the class you are creating. The other class module property, Instancing, can be ignored for now and left at the default setting.

Once your class has been named, you are ready to start adding the code that defines the class. For the most part, this consists of adding properties and methods to the class. A property ...

Get Office® XP Development with VBA 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.