VBA module that runs other modules VBA module that runs other modules vba vba

VBA module that runs other modules


As long as the macros in question are in the same workbook and you verify the names exist, you can call those macros from any other module by name, not by module.

So if in Module1 you had two macros Macro1 and Macro2 and in Module2 you had Macro3 and Macro 4, then in another macro you could call them all:

Sub MasterMacro()    Call Macro1    Call Macro2    Call Macro3    Call Macro4End Sub


Is "Module1" part of the same workbook that contains "moduleController"?
If not, you could call public method of "Module1" using Application.Run someWorkbook.xlsm!methodOfModule.


I just learned something new thanks to Artiso. I gave each module a name in the properties box. These names were also what I declared in the module. When I tried to call my second module, I kept getting an error: Compile error: Expected variable or procedure, not module

After reading Artiso's comment above about not having the same names, I renamed my second module, called it from the first, and problem solved. Interesting stuff! Thanks for the info Artiso!

In case my experience is unclear:

Module Name: AllFSGroupsCYPublic Sub AllFSGroupsCY()

Module Name: AllFSGroupsPYPublic Sub AllFSGroupsPY()

From AllFSGroupsCY()

Public Sub FSGroupsCY()    AllFSGroupsPY 'will error each time until the properties name is changedEnd Sub