Code Modules

All macros reside in code modules like the one on the right of the VBE window in Figure 1-5. There are two types of code modules — standard modules and class modules. The one you see on the right is a standard module. You can use class modules to create your own objects. You won't need to know much about class modules until you are working at a very advanced level. See Chapter 15 for more details on how to use class modules.

Some class modules have already been set up for you. They are associated with each worksheet in your workbook, and there is one for the entire workbook. You can see them in the Project Explorer window, in the folder called Microsoft Excel Objects. You will find out more about them later in this chapter.

You can add as many code modules to your workbook as you like. The macro recorder has inserted the one named Module1. Each module can contain many macros. For a small application, you would probably keep all your macros in one module. For larger projects, you can organize your code better by filing unrelated macros in separate modules.

0 0

Post a comment