how to open every module (that is currently closed) in a workbook

Occasional Contributor

using VBA, how can i open all modules (code modules) in a workbook



    For Each objVbComp In ThisWorkbook.VBProject.VBComponents
        If objVbComp.Name Like "M*" Then
            'this prints all modules that begin with M
            Debug.Print objVbComp.Name
            'how can i open this module?
        End If
    Next objVbComp





0 Replies