1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: How to get to Excel VBA code modules using VBA?

Discussion in 'Business Applications' started by Gregor1234, Nov 5, 2007.

Thread Status:
Not open for further replies.
Advertisement
  1. Gregor1234

    Gregor1234 Thread Starter

    Joined:
    Jun 3, 2004
    Messages:
    237
    In MS Access you can write VBA code that allows you to manipulate the existing VBA code in standard and class modules by using the Modules collection of the application object.

    In Access VBA, the Application.Modules collection contains only open modules

    I am trying to do a similar same thing in Excel but with no luck.

    There appears to be an undocumented Modules collection in Excel but the Modules.Count always comes back as zero. If this works the same way as in Access VBA, then none of the modules are officially "open" (including the one I'm executing).

    Anyone have any experience doing this sort of thing in MS Excel VBA?

    I just want to write some quick and dirty code to do some rudimentary analysis of an Excel application that was dropped on my desk. I want to do things like counting lines of code, and identifying the entry points and global declarations.

    Yes, I can cut and paste all of the code into a text file and analyze that but I was looking for a more elegant solution.
     
  2. slurpee55

    slurpee55

    Joined:
    Oct 20, 2004
    Messages:
    7,837
  3. Gregor1234

    Gregor1234 Thread Starter

    Joined:
    Jun 3, 2004
    Messages:
    237
    YES!

    The link you posted has exactly the info I need.

    Thanks so much.
     
  4. slurpee55

    slurpee55

    Joined:
    Oct 20, 2004
    Messages:
    7,837
  5. Zack Barresse

    Zack Barresse

    Joined:
    Jul 25, 2004
    Messages:
    5,452
    I think Chip Pearson has posted every solution known to the world of Excel on his site. Between him, John Walkenbach and Debra Dalgleish, there isn't much more room to cover! LOL!
     
  6. slurpee55

    slurpee55

    Joined:
    Oct 20, 2004
    Messages:
    7,837
    Well, just so you don't feel bad, on here we still need our Pro-Zack!...er, um.... ;)
     
  7. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/648110

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice