You can write addin for this purpose. Also you can use special undocumented function from vba6.dll in order to obtain code and modules, but it will work only IDE.