I'm writing macros for Excel workbooks. I have a lot of Functions, Subs and Properties declared, which is making the function list rather long and difficult to navigate. For example, other than actually double-clicking on the function, there's no way to tell which module a particular function is in if functions defined in two different modules have the same name.
To make it easier to navigate the function list, I'd like to add a level to the hierarchy to group the functions into their respective modules, so the list would look something like this:
This not only groups them nicely, but it would allow me to collapse the modules I in which I have no interest, while keeping visible those in which I do have an interest. (More flexible than deselecting List for all project files.) This would also be useful for object-oriented languages, in that it would allow one to group methods and their attendant parameters by class.
Looking at the Modify Groups dialog and at the .UEW file itself, it appears that one can nest the groups to more than the two levels that I've seen in all the .UEW files I've looked at, so I tried the following, first by using the Modify Groups dialog, then later by modifying the .UEW file directly. This is the code I wound up with:
Unfortunately, when I apply the .UEW file and refresh my function list, the modules show up, but none of the underlying Functions, Subs or Properties. When I remove the top layer (Modules) from the .UEW file, it goes back to correctly showing the Functions, Subs and Properties.
I'm pretty sure that I know what the various /TGx statements do, but I don't feel confident about my understanding of how they work together to create a hierarchy that works. For example, what is required at each level? What are the subtleties about what TGFindBStart and TBFindBEnd actually do?
Is there a limit that prevents one from nesting the groups to more than two levels? If not, what do I need to do to my code above to make it work the way I want it to? Is there some documentation somewhere that discusses this? If so, I've not been able to find it.
Thanks
To make it easier to navigate the function list, I'd like to add a level to the hierarchy to group the functions into their respective modules, so the list would look something like this:
Code: Select all
Modules
- Module1
- Functions
- Functon1
- Parameters
Param1
+ Function2
+ Subs
.
.
.
+ Modulen
Looking at the Modify Groups dialog and at the .UEW file itself, it appears that one can nest the groups to more than the two levels that I've seen in all the .UEW files I've looked at, so I tried the following, first by using the Modify Groups dialog, then later by modifying the .UEW file directly. This is the code I wound up with:
Code: Select all
/TGBegin "Modules"
/TGFindStr = "^\s*Attribute VB_Name\s+=\s+.*\<(\w+)\W\s*$"
/TGBegin "Functions"
/TGFindStr = "^[\t ]*(?:public[\t ]+|private[\t ]+)*function[\t ]+([a-z][0-9a-z_]*)[\t ]*\("
/TGBegin "Parameters"
/TGFindStr = "\s*([^,]+)"
/TGFindBStart = "\("
/TGFindBEnd = "\)"
/TGEnd
/TGBegin "Return value"
/TGFindStr = "[\t ]*(.+)"
/TGFindBStart = "\)[\t ]+as[\t ]+"
/TGFindBEnd = "$"
/TGEnd
/TGEnd
/TGBegin "Subs"
/TGFindStr = "^[\t ]*(?:public[\t ]+|private[\t ]+)*sub[\t ]+([a-z][0-9a-z_]*)[\t ]*\("
/TGBegin "Parameters"
/TGFindStr = "\s*([^,]+)"
/TGFindBStart = "\("
/TGFindBEnd = "\)"
/TGEnd
/TGEnd
/TGBegin "Properties"
/TGFindStr = "^[\t ]*(?:public[\t ]+|private[\t ]+|friend[\t ]+)*(?:static[\t ]+)*property[\t ]+get[\t ]+([a-z][a-z0-9_]*)[\t ]*\("
/TGBegin "Parameters"
/TGFindStr = "\s*([^,]+)"
/TGFindBStart = "\("
/TGFindBEnd = "\)"
/TGEnd
/TGEnd
/TGEnd
I'm pretty sure that I know what the various /TGx statements do, but I don't feel confident about my understanding of how they work together to create a hierarchy that works. For example, what is required at each level? What are the subtleties about what TGFindBStart and TBFindBEnd actually do?
Is there a limit that prevents one from nesting the groups to more than two levels? If not, what do I need to do to my code above to make it work the way I want it to? Is there some documentation somewhere that discusses this? If so, I've not been able to find it.
Thanks