+ Reply to Thread
Results 1 to 5 of 5

Module running order

  1. #1
    Registered User
    Join Date
    10-07-2009
    Location
    Rhode Island
    MS-Off Ver
    Excel 2003
    Posts
    6

    Module running order

    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?

  2. #2
    Registered User
    Join Date
    06-03-2009
    Location
    Tulsa, OK
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Module running order

    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

  3. #3
    Registered User
    Join Date
    10-07-2009
    Location
    Rhode Island
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Module running order

    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?

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Module running order

    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 be
    Please Login or Register  to view this content.
    So, 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.
    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.

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Module running order

    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
    Cheers
    Andy
    www.andypope.info

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1