PDA

View Full Version : Building a Call Tree (work in progress)



theta
04-22-2013, 07:37 AM
All,

I have requested information on this site a few times relating to call tree listings. This seems to be a bit of a struggle for VBA / not widely used, as the responses were of limited use. When inheriting large projects (mine was 38,000+ code lines) it is very useful to view the call tree.

For the benefit of any members here (or googlers) I have found a working solution that I am currently modifying (to run on single procedures, not entire lists).

My previous requests are listed here :

http://www.vbaexpress.com/forum/showthread.php?t=45945
http://www.vbaexpress.com/forum/showthread.php?t=45832
http://www.vbaexpress.com/forum/showthread.php?t=43525
http://www.vbaexpress.com/forum/showthread.php?t=43163

But the answers did not solve the issue. The easiest solution is to buy Project Analyzer, but I like the $299 in my pocket thank you very much.

After spending a large number of accumulated hours searching, testing and downloading - I have the following :

CallTree97 Add-In (the attached is the version I have updated)
Download 2003 - 2010 adjusted file >>> CallTree97.xla (http://www.mediafire.com/file/tvf3fqb2dont7w7/CallTree97.xla)
Download original file from publisher >>> http://www.oaltd.co.uk/DLCount/DLCount.asp?file=CallTree97.exe
NOTE : OALTD is a great resource, although some of the files are a bit outdated. "They said it couldn't be done" :)

There are other workbooks that I have been playing with. The approach on the first attachment is especially 'elegant' :

VB_MakeTree Recursive Loop (http://www.mediafire.com/file/714akkh3jhn69ra/VB_MakeTree.xlsm)

ToUHSite (http://www.mediafire.com/file/mno6vnfi3nbqn1n/ToUHSite.xlsm)

I hope this is beneficial to the community. I am going to try and adapt it to produce a function that can be called to produce a tree for a given ROOT procedure e.g. GetCallTree("VB_System.Auto_Open"), or I will adjust the existing so that items can be removed from the ProcList label to restrict which subs/functions are analysed (for speed and efficiency).

SamT
04-22-2013, 10:46 AM
Theta,

Thank you for all the work you've put in to this. I have DL'ed all your files and references in case I might want to work on it myself sometime.

I'll be following your progress as you post it.

Another great tool is Baarns consulting group's Excel 97 developers kit. Unfortunately, it looks like the company is defunct, but the kit is still available on the web.

snb
04-23-2013, 02:04 AM
You can find a similar approach here:

http://www.snb-vba.eu/bestanden/__VBA_VBEditor_Projektverkenner.xls

theta
04-25-2013, 09:56 AM
Hi SNB,

Your approach does seem to list all functions. If you run it compared with the other file (uploaded) the results vary. Yours is preferential in many respects, but it does not find all levels of the call tree?

magelan
04-25-2013, 01:24 PM
[Clippy comes up] It looks like youre trying to make money with other peoples ideas! Do you need a hand? If this is honestly just for your own use, do the debugging yourself..Control-F for "Debug.print" and replace with " 'debug.print", Control-F for "Call" and put debug.print "-Calling subroutine2" above every call statement. Voila, tree is made.

theta
04-26-2013, 04:38 AM
[Clippy comes up] It looks like youre trying to make money with other peoples ideas! Do you need a hand? If this is honestly just for your own use, do the debugging yourself..Control-F for "Debug.print" and replace with " 'debug.print", Control-F for "Call" and put debug.print "-Calling subroutine2" above every call statement. Voila, tree is made.

I am not trying to make any money. I am trying to find a working solution as I have had to manually analyse 38k+ lines of code :


For the benefit of any members here (or googlers) I have found a working solution that I am currently modifying (to run on single procedures, not entire lists).

It took me a while to get to this stage but I think this is one of the most useful functionalities I have come across (as a developer). No desire for personal gain.

Would just like an automated solution to build a call tree so that I can trace dependencies with multiple (up to 10) levels.

Will keep you all posted on updates :thumb

snb
04-26-2013, 04:55 AM
If you post a workbook you want to be analysed I can apply my 'projektverkenner' and look where the code can be amended.