Consulting

Results 1 to 5 of 5

Thread: Get Function / Sub list in macro module

  1. #1
    VBAX Regular
    Joined
    Apr 2012
    Posts
    24
    Location

    Get Function / Sub list in macro module

    I have a macro with a lot of functions and subs inside of "NewMacros" under "Modules".
    Is there a way to write a list of these to a file? EG

    MyFunction1(arg1 as string) as string
    MySub1()
    MySub2(arg4 as boolean) as string
    .
    .
    .
    .
    .
    MyFunction(N)
    I saw posts on the internet by Chip Pearson, but I cant make them work.
    Maybe we can get fancy and include the number of lines too.
    Thanks
    Mike

  2. #2
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,713
    Location
    "I saw posts on the internet by Chip Pearson, but I cant make them work."

    Please post a link.

    What does not work?

    Are you sure you have a reference to VBA Extensibility?

    Have you googled this? There are many examples.

  3. #3
    VBAX Regular
    Joined
    Apr 2012
    Posts
    24
    Location
    I did the reference , the security setting and I get an error about subscript out of range. The error was where I referenced my module.
    Mike

  4. #4
    VBAX Master
    Joined
    Feb 2011
    Posts
    1,480
    Location
    It really depends on why you want to do this. Do you *really* need to use the VBProject object module to do this on a regular basis? Or are you looking for a one-off in order to better organize your code?

    If it's a one-off, you simply copy and paste the entirety of the code module into a word document, do some find/replace functions so that each paragraph containing "Sub " and "Function " gets formatted as Heading 1... and then use a TOC to show what you need to show. From there that would presumably be what you need in order to organize your module better.

    If, considering the above, you can't get something to work... please post the code you are working with, and we can probably make some adjustments. But otherwise, I agree with Fumei... there are a lot of samples to do this stuff. We don't really want to start from scratch with a sample completely differently than the one you've been trying to make work.

  5. #5
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,713
    Location
    And I agree with Frosty. If this is a one-off, or even a three-off, just copy and paste the module contents and then sort, or format as you need.

Posting Permissions

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