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