Importing and Exporting Modules

Modules are not stored as separate files, but rather as a part of the project they are in. If you want a copy of a module to use in another project, or to give to a colleague, you must export the module to create a separate file containing the module's code. To export a module, be sure it is active (selected in the Project Explorer). Then, select Export File from the File menu. VBA will display the Export File dialog box where you specify the location for the file and, if desired, change the default filename (which is the same as the module's Name property). You should not change the default file extension, which is .BAS for standard modules, .FRM for UserForm modules, and .CLS for class modules.

To import a module, ...

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.