Sub ListMacros()
With Application
.ScreenUpdating = False
.EnableEvents = False
.DisplayAlerts = False
End With
Dim strSheetName$, strLine$
Dim intLine%, intArgumentStart%
Dim xRow&, objComponent As Object
strSheetName = "zzzCompiler"
xRow = 1
On Error Resume Next
Sheets("zzzCompiler").Delete
Err.Clear
Sheets.Add(After:=Sheets(Sheets.Count)).Name = "zzzCompiler"
For Each objComponent In ActiveWorkbook.VBProject.VBComponents
If objComponent.Type = 1 Then
For intLine = 1 To objComponent.CodeModule.CountOfLines
strLine = objComponent.CodeModule.Lines(intLine, 1)
strLine = Trim$(strLine)
If Left$(strLine, 3) = "Sub" Or Left$(strLine, 11) = "Private Sub" Then
intArgumentStart = InStr(strLine, "()")
If intArgumentStart > 0 Then
If Left$(strLine, 3) = "Sub" Then
Cells(xRow, 1).Value = Trim(Mid$(strLine, 4, intArgumentStart - 4))
xRow = xRow + 1
ElseIf Left$(strLine, 10) = "Public Sub" Then
Cells(xRow, 1).Value = Trim(Mid$(strLine, 4, intArgumentStart - 11))
xRow = xRow + 1
Else
Cells(xRow, 1).Value = Trim(Mid$(strLine, 12, intArgumentStart - 12))
xRow = xRow + 1
End If
End If
End If
Next intLine
End If
Next objComponent
With Application
.DisplayAlerts = True
.EnableEvents = True
.ScreenUpdating = True
End With
End Sub