hat einer eine Idee, wie ich alle Makros einer Mappe in einer Tabelle auflisten kann?
Gruß aus'm Pott
Udo
Sub MakroListe()
Dim vbc As Object, sh As Worksheet
Dim iRow As Integer, iCol As Integer, iCounter As Integer
Dim sMacro As String
Set sh = ThisWorkbook.Sheets(1)
sh.Cells.Clear
sh.Rows(1).Font.Bold = True
iRow = iRow + 1
iCol = 1
For Each vbc In ActiveWorkbook.VBProject.VBComponents
With vbc.CodeModule
For iCounter = 1 To .CountOfLines
If .ProcOfLine(iCounter, 0) > "" Then
sMacro = .ProcOfLine(iCounter, 0)
If sMacro <> sh.Cells(iRow, iCol) Then
iRow = iRow + 1
sh.Cells(iRow, iCol).Value = sMacro
End If
End If
Next iCounter
End With
Next vbc
sh.Columns.AutoFit
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)"
.InsertLines 4, " ThisWorkbook.Saved = True"
.InsertLines 5, "End Sub
"
Sub MakroListe()
Dim vbc As Object, sh As Worksheet
Dim iRow As Integer, iCol As Integer, iCounter As Integer
Set sh = ThisWorkbook.Sheets(1)
sh.Cells.Clear
iRow = 1
iCol = 1
For Each vbc In ActiveWorkbook.VBProject.VBComponents
With vbc.CodeModule
For iCounter = 1 To .CountOfLines
If .ProcOfLine(iCounter, 0) > "" Then
If .Lines(iCounter, 1) Like "Sub*" Then
sh.Cells(iRow, iCol).Value = .ProcOfLine(iCounter, 0)
iRow = iRow + 1
End If
End If
Next iCounter
End With
Next vbc
sh.Columns.AutoFit
End Sub
Sub MakroListe()
Dim vbc As Object, sh As Worksheet
Dim iRow As Integer, iCol As Integer, iCounter As Integer
Dim sMacro As String
Set sh = ThisWorkbook.Sheets(1)
sh.Cells.Clear
sh.Rows(1).Font.Bold = True
iRow = iRow + 1
iCol = 1
For Each vbc In ActiveWorkbook.VBProject.VBComponents
With vbc.CodeModule
For iCounter = 1 To .CountOfLines
If .ProcOfLine(iCounter, vbext_pk_Proc) > "" Then
sMacro = .ProcOfLine(iCounter, vbext_pk_Proc)
'##### NEU
sLine = .Lines(iCounter, 1)
If sLine Like "Public Sub*" Then
sh.Rows(iRow).Font.ColorIndex = 5
End If
If sMacro <> sh.Cells(iRow, iCol) Then
iRow = iRow + 1
sh.Cells(iRow, iCol).Value = sMacro
End If
End If
Next iCounter
End With
Next vbc
sh.Columns.AutoFit
End Sub