Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912

    Unanswered: Iterate Code Modules

    Hi

    In Access there is a Modules container and Module objects that can be iterated, read from and written to. Doesn't seem so in Excel - is this correct please?

    Thanks
    Testimonial:
    pootle flump
    ur codings are working excelent.

  2. #2
    Join Date
    Sep 2008
    Location
    London, UK
    Posts
    511
    Hi,

    I don't use this part of the object model very often....

    A CodeModule belongs to a VBComponent object which can be referenced via the VBComponents object collection. For early binding a reference to the Microsoft VBA Extensibility library is required:
    Code:
    Sub foo()
    
        Dim vbc As VBIDE.VBComponent
        
        For Each vbc In ThisWorkbook.VBProject.VBComponents
            Debug.Print vbc.Name
            'vbc.CodeModule....
        Next vbc
        
    End Sub

    There's lots of examples and a good explanation of the hierachy at Chip Pearson's site:
    Programming In The VBA Editor

  3. #3
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Lol - I almost addressed my question directly to you

    Thanks again Colin - I will have a nose.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  4. #4
    Join Date
    Sep 2008
    Location
    London, UK
    Posts
    511
    lol.... keep 'em coming...

Posting Permissions

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