Ergänzung
13.10.2018 17:20:02
sigrid
Hallo zusammen,
dises beiden Makros gehören dazu:
Private Function ShellBrowseForFolder(Optional StartPath As String = "") As String
Dim objShell As Object
Dim lngRoot As Long
Dim objFolder As Object
lngRoot = 17
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.BrowseForFolder(0, "Ordner auswählen", 0, IIf(Len(StartPath), _
StartPath, lngRoot))
'Set objFolder = objShell.BrowseForFolder(0, "Ordner auswählen", 0, IIf(Len(StartPath), _
StartPath, lngRoot))
If Not objFolder Is Nothing Then
ShellBrowseForFolder = objFolder.Self.Path
End If
Set objFolder = Nothing
Set objShell = Nothing
End Function
Private Function countFiles(ByVal Directory As String, Optional ByVal FileName As String = "", _
Optional ByVal SubFolders As Boolean = False) As Long
Dim objFSO As Object, objFolder As Object, objFile As Object, objSubF As Object
Dim lngCount As Long
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(Directory)
If Len(FileName) Then
For Each objFile In objFolder.Files
If objFile.Name Like FileName Then lngCount = lngCount + 1
Next
Else
lngCount = objFolder.Files.Count
End If
If SubFolders Then
For Each objSubF In objFolder.SubFolders
lngCount = lngCount + countFiles(objSubF.Path, FileName, SubFolders)
Next
End If
countFiles = lngCount
Set objSubF = Nothing
Set objFile = Nothing
Set objFolder = Nothing
Set objFSO = Nothing
End Function
funktioniert alles, ich möchte NUR die letzten beiden Verzeichnisse angezeigt
erhalten, in diesem Fall das Jahr und der Monat.
mfg
sigrid