Office macros are grouped in module files, modules are usually grouped in library folders, and libraries are grouped in library containers although containers can contain modules too.
A library is used as a major grouping for either an entire category of macros, or for an entire application. Modules usually split functionality, such as user interaction and calculations. Individual macros are subroutines and functions. The Figure below shows an example of the hierarchical structure of macro libraries in Office.
Figure: Macro Library hierarchy
The containers are accessible in all Office programs through the user interface. Go to Tools > Macros > Organise Macros > Python, to open the Python Macros dialogue box.
Three library containers are shown in the Macro From list:
My Macros: personal macros available for the Office user
Application Macros: system macros distributed with Office for every computer user
Document macros: every document can contain macro libraries available in that document for all users
Refer to Getting Session Information in order to get programmatic access to Python script locations.
Existing macros in this location (container) were copied by the installation program and are available to every computer user, and any open document can access macros stored the container. You need administrative rights to store or edit macros here.
The Office Macros container location in the file system depends on the operating system:
This container is accessible only by the Office user. Any open document can access macros stored the container. Macros in this location are stored in the Office user profile.
The My Macros container location is in the user space and depends on the operating system:
Document macros are embedded in the document and are accessible only when the document is open.
Python macros can be organised in libraries, modules and macros. Use the Macro Library hierarchy as a guide when creating or installing new macros in module files, new module files in library folders or new library folders in containers.