• VBA Code Scanner (XL 2003)

    Author
    Topic
    #420393

    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
    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?

    Viewing 0 reply threads
    Author
    Replies
    • #951821

      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.)

      • #951961

        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.

    Viewing 0 reply threads
    Reply To: VBA Code Scanner (XL 2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: