PDA

View Full Version : VBA module / sub / function tree



theta
09-04-2012, 05:00 AM
Is there an addin / functionality that will build a dependency tree from a given control e.g.

Sub 1 > Sub 2 > Function 3 > Function 4 etc.

When I click on any given sub it may launch into several other subs / classes / functions. I would like to be to able to capture this so that I can document the connectivity between all items in the various projects I work on.

I looked at MZTool, but this just lists the subs and functions - not the links and calls between them.

?

snb
09-04-2012, 07:25 AM
Please post some example and we can construct something.

theta
09-04-2012, 08:07 AM
I do not have a ready example to upload i'm afraid.

I am working on a project that has 5 user forms and 25 modules, each full of subs and functions.

So clicking on "Ok" on a userform may launch a sub, which in turn calles other subs and functions.

I just want a way to capture the heirachy / links between all attributes?

Even if I can run through a process manually and 'record' what is called on the fly?

snb
09-04-2012, 08:18 AM
I think you have I'm afraid....
Because I understood your question (no need to repeat it) I asked for your example.

theta
09-04-2012, 08:22 AM
Ok i'll rephrase that...I do not have an example that i'm allowed to upload. This is a large scale project with 20,000+ lines of code across several modules.

The logic behind it is simple, but I am not sure how to convey this into an addin / sub to produce such a report.

It could either analyse every item in the VBE, based on a start item. Or it could record all sub / function calls when I run through a process. This approach would work with any project, and file, any complex example.

Kenneth Hobs
09-04-2012, 09:26 AM
If you want to track that then you have to add code to each part. It will be a nightmare to maintain. IF you decide to continue, decide how you want to track it. Poke the data into a log file, the Immediate window, registry, etc.

theta
09-04-2012, 09:35 AM
Hmmm I was hoping there was a way to do this through code. MZTools will show the calling heirachy for a single sub. Just want this applied to an entire project.

I'm sure others would really benefit from this - which is why I can't believe something doesn't exist? "Map Project Heirachy" or "Build Dependency Tree" for a given module or sub.

Bob Phillips
09-04-2012, 11:14 AM
Take a look at http://www.aivosto.com/project/project.html

theta
09-05-2012, 02:45 AM
I looked at that site (after seeing this article - http://www.dailydoseofexcel.com/archives/2007/12/13/vba-code-documenting-tools-project-analyzer-and-visustin/)

All I really need is the ability to list subs and calls (as shown on the above link). Was hoping there would be a VBE addin for this, don't really want to run a standalone program to analyse a project.

Thanks for all the input.

AirCooledNut
09-05-2012, 10:07 AM
I'm guessing it's not as easy as one thinks which is why no one has made such a tool for free.

I looked at the site (http://www.aivosto.com/) the dailydose (http://www.dailydoseofexcel.com/archives/2007/12/13/vba-code-documenting-tools-project-analyzer-and-visustin/) mentions and it gets pretty complex/involved.