Results 1 to 4 of 4
  1. #1
    5 Star Lounger Ruff_Hi's Avatar
    Join Date
    Feb 2001
    Location
    New York, New York, USA
    Posts
    768
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VBA Code Scanner (XL 2003)

    We have written rather a large project in XL VBA. Most (but not all) of the subs and functions have a standard error catching routine in them while some have a non standard error catching routine. Is there some way of getting a list of subs and functions that ...

    a) have the standard error catching routine
    [img]/forums/images/smilies/cool.gif[/img] have a non standard error catching routine
    c) have no error catching routine

    The alternative is that I print the code to file and write a macro that scans each sub and function. Unfortunately, when I print to file it comes out as gobble gook - so, how do I print code to file?
    (Location Australia, then UK, but now USA. Heart, outlook, attitude, etc always Australian)
    Quote: "All Happiness is the release of internal pressure"

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: VBA Code Scanner (XL 2003)

    You can use File | Export File... in the Visual Basic Editor to export a module to a text file. Its default extension is .bas for a standard module and .cls for a class module (such as a worksheet or ThisWorkbook module), but you can specify All Files as file type and any extension you like, for example .txt.

    (Alternatively, you can set a reference (in Tools | References...) to the Microsoft Visual Basic for Applications Extensibility 5.3 library, this lets you use code to manipulate code. It's not very easy to use though. some examples can be found in Programming To The VBE.)

  3. #3
    5 Star Lounger Ruff_Hi's Avatar
    Join Date
    Feb 2001
    Location
    New York, New York, USA
    Posts
    768
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA Code Scanner (XL 2003)

    Thanks Hans - I knew about the export option but I have about 12 modules, 12 forms and about 4 classes - basically, I didn't want to deal with the 'pain' of manually exporting 30ish objects. I'll give VBE a whirl and let you know how I get on.
    (Location Australia, then UK, but now USA. Heart, outlook, attitude, etc always Australian)
    Quote: "All Happiness is the release of internal pressure"

  4. #4
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA Code Scanner (XL 2003)

    My AutosafeVBE has an option to export the activeworkbook's entire VBProject
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

Posting Permissions

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