logo
search
VBA & Macro Problems

How to List Procedures Called by Other Procedures in Excel VBA

Natalie TaylorNatalie Taylor Sep 30, 2026 871 views

Question details

The user wants to identify calling procedures, called procedures, and destination modules across a VBA project containing multiple modules.

How to List Procedures Called by Other Procedures in Excel VBA
Product
Excel VBA
Device & OS
not provided
Scenario
Mapping dependencies and identifying procedure calls across various modules within an extensive VBA project.
Observed behavior
The VBA Extensibility library does not offer a native runtime dependency API, requiring users to rely on static text analysis to find procedure calls.
Before you start

Before analyzing your code programmatically, ensure you have navigated to your macro security settings and enabled 'Trust access to the VBA project object model' to prevent permission errors.

Solution 1Recommended

Perform Static Text Analysis using the VBA Extensibility Library

Use the VBA Extensibility library to programmatically read the source code text in your modules and use string matching to map procedure dependencies.

Since VBA lacks a built-in runtime execution tracker for procedure dependencies, you can iterate through the project components statically. By extracting the text of each module, you can search for occurrences of your procedure names to determine where they are being called.

1
Enable Project Access

Open Excel, go to the Developer tab, click 'Macro Security', and check 'Trust access to the VBA project object model' under Developer Macro Settings.

2
Add the Extensibility Reference

Press Alt + F11 to open the Visual Basic Editor. Click 'Tools' > 'References', then find and check 'Microsoft Visual Basic for Applications Extensibility 5.3'.

3
Iterate Through Modules

Write a VBA script that loops through 'ThisWorkbook.VBProject.VBComponents' to access the CodeModule object of each standard module, class, or userform.

4
Search for Procedure Names

Use the 'CodeModule.Lines' property to extract the source code text line by line. Apply string matching functions like 'InStr' or regular expressions to search for specific procedure names and record the module where the call is found.

Perform Static Text Analysis using the VBA Extensibility Library
Static vs. Runtime Analysis: String matching is a static analysis method. It will map explicit code references but cannot trace dynamic calls (like Application.Run) or conditional runtime execution paths.
Advanced Macro Management

Analyze and Manage VBA Macros with WPS Office

WPS Office provides excellent support for VBA macros and developer tools. You can seamlessly run Extensibility scripts to map procedure dependencies within a fast and familiar environment.

  1. 1. Download and Install WPS Office: Get the latest version of WPS Office from the official website and complete the installation.
  2. 2. Open Your Macro Workbook: Launch WPS Spreadsheet and open your .xlsm or .xlsb workbook containing the complex VBA project.
  3. 3. Access the Developer Tools: Navigate to the Developer tab on the ribbon and click the 'Visual Basic' or 'Macro' icon to open the integrated code editor.
  4. 4. Run Analysis Scripts: Insert your dependency mapping script into a new module and execute it to extract the procedure calling hierarchy.
Highly compatible with Microsoft Excel VBA formats (.xlsm, .xlam, .xlsb)Built-in Visual Basic Editor for writing, debugging, and maintaining complex scriptsLightweight architecture ensuring fast execution of static analysis across large codebasesFree to download with a familiar spreadsheet interface
QA img-9

Frequently Asked Questions

Why is string matching considered expensive in large VBA projects?

String matching requires reading every line of code across all modules and comparing it against a list of all known procedure names. In massive projects, this iterative parsing requires significant CPU cycles, though using efficient search algorithms or regular expressions can mitigate the delay.

Can I track runtime procedure calls dynamically instead of using static analysis?

VBA does not natively expose a runtime call stack API for programmatic logging. To track execution dynamically, you must manually insert logging code (like 'Debug.Print' or writing to a log file) at the beginning of each procedure.

What happens if a procedure name is used as a variable or string literal?

Basic static string matching (using InStr) might yield false positives by identifying variables, comments, or string literals that happen to share the same name as a procedure. Using regular expressions to isolate exact procedure call syntax or ignoring commented lines is recommended to improve accuracy.