VBA – Listing all procedures in all modules

Sometimes you need to unite two projects into one in VBA. In these two projects, if you are using similar “own built libraries” you are in a kind of trouble. The trouble is called Compile Error :Ambiguous name detected: name

Then you start looking, which one and where you should delete and which one and where you should be using. It is no fun at all.

vba

Fortunately, there is a Library called Applications Extensibility 5.3. library which allows you to do fancy stuff with code in VBA. E.g., you may create a code writing code or you may read the code of your code. Long story short, you may loop through the VBA program, select all the modules and print the names of the sub-routines or the functions. And their “parents” if needed. Once you have them, you can simply sort them and see which one are repeatable. Then the whole task becomes easier. This is how the code looks like:

In stead of CreateLogFile you may simply print the file. Or search a bit for CreateLogFile in my GitHub repository, it should not be tough!

That’s all! Cheers! 🙂

Tagged with: , , ,