Consulting

Results 1 to 3 of 3

Thread: Searching for VBA Code

  1. #1

    Searching for VBA Code

    Hi,

    I have rather a lot of VBA spread across probably hundreds of Excel, Access and Word documents.

    Is there any way of searching for VBA code within office files? It would be nice to catalog what I have got but being able to find function and sub names would be a good start.

    You cannot search the file contents so was wondering whether there are any applications out there designed for this or maybe another way to search?

    Thanks

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Searching the VBA code (which is not especially difficult) would require programmatic access to the VBA code in the Office files concerned. Doing that would in turn require giving trusted access to the VBA environment, which is a significant security risk.

    Although the code in the following link doesn't actually extract VBA code, it should give you a reasonable idea of what's involved:
    Use VB script to paste code into a module? (microsoft.com)
    The code to Copy A VBA Module From One Document To Another would be most relevant to your project.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    You might have to join VBAExpress.com to see these:

    IMO, the last entry is most helpful.Although one of the earlier entries has 200 Procedures designed for your use.

    https://peltiertech.com/list-vba-pro...-vb-procedure/
    http://www.cpearson.com/excel/vbe.aspx

    You're looking at thousand(s) of Procedures when done. How do you intend to organize the list? I suggest by Application, then Full Address, File Name, Module Name, (ThisWorkbook" and Worksheets are Excel Modules,) Procedure Name, Parameters List ,Author, Comments.

    I would start this search with a list of all Root Directories that need to be searched, then search each in Application order for relevant File extensions.
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

Posting Permissions

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