Adding modules to the library
Most programmers at some point start collecting modules containing solutions they previously used succesfully, with the purpose of later using them again. Code VBA provides a library feature which makes it possible to save your modules in an organized way.
Code modules may contain one or more procedures that can function independently. Some solutions however require a combination of modules and een code snippets.

Adding a single module
To add a module in your current project to the library:
- Clean up the module so that it has a clearly defined purpose and only contains procedures for that;
- Give the module a suitable name;
- In the Code Explorer right-click the module to export and select 'Export file';
- Chosing a location in the \VBA Code folder most suitable to store the module.
Example: modStringFunctions
A collection of common String manipulation functions is in the \VBA\String subfolder of the Code VBA library. As such, it functions are accessible from the VBA » String menu.

Looking at the tooltip of the procedure StringContains
we see a title that indicates what behaviour we may expect.
Procedures that operate on Objects
The image below, showing the Code Library folder hierarchy, the folder of Workbook is opened. The right pane shows which modules are inside.
It seems logical to have modWorkbookFindProcedures or modRangeNameProcedures in there, containing procedures related to Finding (ranges).
But why is modSheetIsProcedures in this folder, and not in folder \Worksheet?
The reason is the modules contains procedures, such as IsValidSheetName
,
that don't work on a Worksheet object, but are useful in the context of a Workbook object.
Chosing a location to store a module
The Code VBA library already has a structure reflecting VBA and Office application's Objects. We suggest you follow this design, when adding modules.


- it does not recognize module containing the procedure is already present, inserting it a second time causing compile error;
- it wrongly assumes the module is already present and does not add the module.