AW: Übersicht eigene VBA Funktionen zusammenstellen
10.11.2008 19:40:48
Erich
Hallo Dietrich,
eventuell bricht das Makro ab, weil ein Projekt geschützt ist.
Auf Basis von Nepumuks Code hab ich mal das hier gebastelt:
Option Explicit
Public Sub MakroListe() ' nach Nepumuk, 10.11.2008 12:23:40
' www.herber.de/forum/archiv/1020to1024/t1023170.htm#1023175
Dim objVBC As Object, wbk As Workbook, strMak As String, intZ As Integer
Dim lngF As Long, lngR As Long, strM As String, wksE As Worksheet, lngC As Long
Const bolShow As Boolean = True ' False, wenn's schneller gehen soll
Set wksE = ThisWorkbook.Worksheets(1)
wksE.Cells.ClearContents
wksE.Range("A1:E1") = Split("File Nr Datei Makroname Schutz")
With Application
.ScreenUpdating = False
.EnableEvents = False
With .FileSearch
.NewSearch
.FileType = msoFileTypeExcelWorkbooks
.LookIn = ThisWorkbook.Path ' "c:\temp"
.SearchSubFolders = True
.Execute
lngR = 1
For lngF = 1 To .FoundFiles.Count
Application.StatusBar = .FoundFiles.Count & " / " & lngF
If .FoundFiles(lngF) ThisWorkbook.FullName Then
strM = .FoundFiles(lngF)
Set wbk = Workbooks.Open(strM, False, True)
lngC = 0
If wbk.VBProject.Protection Then
lngR = lngR + 1
wksE.Cells(lngR, 1) = lngF
wksE.Cells(lngR, 2) = 0
wksE.Cells(lngR, 3) = strM
wksE.Cells(lngR, 4).ClearContents
wksE.Cells(lngR, 5) = "#geschützt#"
Else
For Each objVBC In wbk.VBProject.VBComponents
With objVBC.CodeModule
For intZ = 1 To .CountOfLines
If .ProcOfLine(intZ, 0) "" Then
If strMak .ProcOfLine(intZ, 0) Then
strMak = .ProcOfLine(intZ, 0)
lngR = lngR + 1
lngC = lngC + 1
wksE.Cells(lngR, 1).Value = lngF
wksE.Cells(lngR, 2).Value = lngC
wksE.Cells(lngR, 3).Value = strM
wksE.Cells(lngR, 4).Value = strMak
End If
End If
Next
End With
Next objVBC
End If
wbk.Close SaveChanges:=False
End If
If bolShow Then
Application.Goto Cells(Application.Max(1, lngR - 30), 1), True
Application.ScreenUpdating = True
Application.ScreenUpdating = False
End If
Next lngF
End With
.ScreenUpdating = True
.EnableEvents = True
.StatusBar = False
End With
End Sub
Die Files werden hier nicht in Spalten nebeneinander, sondern in Zeilen aufgelistet.
Hier eine Mappe zum Spielen: https://www.herber.de/bbs/user/56661.xls
Rückmeldung wäre nett! - Grüße von Erich aus Kamp-Lintfort