In an Add-in, if there are more than 1 module present, how can you tell which order the modules run in? Alphabetical? Is there a tag somewhere in the code of each module that deems its place in the overall order of the program?
In an Add-in, if there are more than 1 module present, how can you tell which order the modules run in? Alphabetical? Is there a tag somewhere in the code of each module that deems its place in the overall order of the program?
In an Add-in, the modules don't run unless a subroutine within them is called. But to simply answer your question, it's in the order you wrote the code (From top to bottom) and Module 1 should run before Module 2
Thanks Spudley. I'm trying to figure out exactly how and where the subroutines in the modules are being called. The modules don't have sequential names like "1, 2, 3, etc". The modules are listed alphabetically and
I didn't write the add-in myself, it was just kind of dumped.. err... passed onto me, so I'm not sure on what exactly is in each of them. Is there a line of code in the modules or something I could look for that would help delineate them?
There is more than likely no relationship in the rank of the module name/number and when it's called or runs. Just today, I was documenting a project that I've written over the last 10 months to determine what modules/procedures are used where and when. When I was developing the project (also using an Add-In), I always used the Call convention, that is, when calling a procedure the code would beSo, you could try that approach. Search the entire project for the key word "Call". If your project was written with that convention, you'll find each "Call" within the project.Please Login or Register to view this content.
An even surer approach would be to do a project search on the Sub name itself. If you get a hit inside another procedure you know where it's being called from. If you get a hit only on the Sub itself, it's either a stand alone procedure (perhaps run from a command button) or perhaps it's not used at all. If you have UserForms, look also in the code behind them. Perhaps this will help get you started.
J
John
If you have issues with Code I've provided, I appreciate your feedback.
In the event Code provided resolves your issue, please mark your Thread as SOLVED.
If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.
Order of module and the routines within them have no impact on the order the code works.
The only thing with a predifined order would be the events fired whilst loading/opening the addin.
The addin should perform some code in order to build a UI for it use. This could be menus, toolbars of keyboard short-cuts. This building will normally take place via the addin install or workbook load event.
So check in Thisworkbook object to see if there is any code in it's events.
Assuming there is and a menu is built then the buttons will have been assigned a routine to run when pressed. This are the entry points into the code.
From this you can follow the calls to other routines/functions.
You may find this addin useful in understanding the project.
http://www.mztools.com/v3/mztools3.aspx
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks