I have several dozen VBA code modules that I have created over the years.
Most of these code modules are self-contained (i.e., they are NOT dependent on any subroutines or functions contained in other VBA code modules).
However, for the few code modules that do make “calls” to functions in other code modules, is there a way (using VBA and the Microsoft Visual Basic for Applications Extensibility 5.3 library) to get of list of those “called” procedures?
For example, below are two VBA code modules and their associated VBA procedures (very simplistic):
Module Name | Procedure Name | Dependency on Other Module |
---|---|---|
Module1 | Sub Foo | Makes a call to Moo |
Module1 | Function Boo | Makes a call to Doo |
Module1 | Function Koo | None |
Module2 | Sub Roo | None |
Module2 | Function Moo | Makes a call to Koo |
Module2 | Function Doo | Makes a call to Boo |
The output I’m seeking should look like the following:
Module Name | Procedure Name | Called Procedure | Contained in Module |
---|---|---|---|
Module1 | Sub Foo | Function Moo | Module2 |
Module1 | Function Boo | Function Doo | Module2 |
Module2 | Function Moo | Function Koo | Module1 |
Module2 | Function Doo | Function Boo | Module1 |
I have tried searching for one or more APIs within the Microsoft Visual Basic for Applications Extensibility 5.3 library that can get the modules/methods that are called by a method, but to date, I haven’t found any.
Any help or guidance would be greatly appreciated. Thanks!
emerald77 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.