Ich habe ein Makro geschrieben, dass automatisch ein anderes Makro erstellt. Allerdings weiß ich nicht wie ich überprüfen kann ob dieses generierte Makro schon existiert, damit das Makro nicht öfter als einmal erstellt werden kann.
Danke,
Stefan
Option Explicit
Sub MakroListe()
' von K.Rola
Dim objVBA As Object
Dim c As Long, r As Long, i As Long, Anfang As Long, Ende As Long
Dim strCode As String
Cells.Clear
For Each objVBA In ThisWorkbook.VBProject.VBComponents
If objVBA.Type = _
vbext_ct_ClassModule Or _
vbext_ct_Document Or _
vbext_ct_StdModule Then
r = 1
c = c + 1
Cells(r, c) = objVBA.Name
Cells(r, c).Font.Bold = True
With objVBA.CodeModule
For i = 1 To .CountOfLines
If .ProcOfLine(i, vbext_pk_Proc) > "" Then
strCode = .ProcOfLine(i, vbext_pk_Proc)
If strCode <> Cells(r, c) Then
r = r + 1
Cells(r, c) = strCode
End If
End If
Next i
End With
End If
Next
Cells.Columns.AutoFit
End Sub