Consulting

Results 1 to 5 of 5

Thread: Sleeper: Find all macros used

  1. #1

    Sleeper: Find all macros used

    Hi

    Is there any trick how can I find all the macros used in a particular "sheet" not the whole workbook but a particular sheet

    Regards,
    mayur

  2. #2
    Administrator
    Chat VP
    VBAX Guru johnske's Avatar
    Joined
    Jul 2004
    Location
    Townsville, Australia
    Posts
    2,872
    Location
    Hi Mayur,

    Just go into the VBE window and double-click the sheet module you want...

    HTH
    John
    You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you

    The major part of getting the right answer lies in asking the right question...


    Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.

  3. #3
    Hi

    The worksheet has no buttons or combo boxes
    The worksheet uses some macros from the personal.xls which is in place
    Which all macros are used?
    How do U identify this?
    Something similar to the formulas we find "=" in the whole sheet
    What for the macros?

    regards,
    mayur

  4. #4
    The pnly thing that comes to mind (and it's clumsy) is to define a static variable (count accumulator) in Personal for each macro that might be used. As each macro is entered, it can ask what is the active sheet. If it's the one of interest, then it could add 1 to the counter. I told you it's clumsy.

  5. #5
    VBAX Expert
    Joined
    Feb 2005
    Posts
    929
    Location
    Quote Originally Posted by mayur_m3
    Hi

    The worksheet has no buttons or combo boxes
    The worksheet uses some macros from the personal.xls which is in place
    Which all macros are used?
    How do U identify this?
    Something similar to the formulas we find "=" in the whole sheet
    What for the macros?

    regards,
    mayur
    I am confident that "somewhere" there is a documented and fully coded method to do this. But since I do not know where that is, a few thoughts:

    It would be possible to interrogate the code modules in the open workbook and all referenced libs (for which you have source) and build "maps" for any given "parent" procedure. Thus if you knew that a given workbook would use, say, ProcA, ProcB and ProcC, you could, via one of these maps, understand all child procs down to the dll level. I can envision a recusive routine that would work its way from any given "top" down to the "bottom".
    A (partial solution) alternative would have been to use good coding conventions and clearly document each child proc used by a given parent. I comment each proc I write and include, for example:

    ' Public/Private Variables used: NONE
    ' VB/VBA procedures called:
    ' mid
    ' len
    ' MATools/MWETools procedures called:
    ' MWE_InRangeI
    ' External Files Accessed: NONE

    This would make it much easier to figure out maps but would also mean that the map is completely dependent on the developer's comments vs the actual code.

Posting Permissions

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