Function FindProcedures(ByRef wb As Workbook, ByVal Proc As String) As Boolean
    On Error GoTo ExitFunction
    
    Dim VBComp
    Dim 
CodeMod
    Dim LineNum As Long
    Dim ProcKind
    
    For Each 
VBComp In wb.VBProject.VBComponents
        If VBComp.Name = "模块1" 
Then
        
            With VBComp.CodeModule
            
                For N = 1 To .CountOfLines
                    s = 
.Lines(N, 1)
                    If InStr(s, Proc) > 0 
Then
                        FindProcedures = True
                        
Exit Function
                    End If
                    
                Next
            End With
        
        End 
If
    Next
    
    Exit Function
原文:http://www.cnblogs.com/lbnnbs/p/4784890.html