Option Explicit Sub TestModExists() Debug.Print ModExists("ArcID") Debug.Print ModExists("xxx") End Sub Function ModExists(name As String) As Boolean ModExists = False Dim pVBE As VBIDE.VBE Set pVBE = Application.VBE Dim l As Long For l = 1 To pVBE.VBProjects.Count Dim k As Long For k = 1 To pVBE.VBProjects(l).VBComponents.Count If pVBE.VBProjects(l).VBComponents(k).Type = vbext_ct_StdModule Then Dim s As String s = UCase(pVBE.VBProjects.Item(l).VBComponents(k).name) If s = UCase(name) Then ModExists = True Exit Function End If End If Next k Next l End Function