自作ツールの一部なのですが如何でしょうか。
Public Function FindPath(ByVal FindTopPath As String) As String
Dim scrptFldr As Scripting.Folder
Dim scrptFile As Scripting.File
Dim R As Long
On Error GoTo Err_FindPath
DoEvents
'ファイル
For Each scrptFile In zzFSO.GetFolder(FindTopPath).Files
R = R + 1
Cells(R, 1) = "F"
If Right$(FindTopPath, 1) <> "\" Then
Cells(R, 3) = FindTopPath
Else
Cells(R, 3) = FindTopPath
End If
Cells(R, 4) = scrptFile.Name
Cells(R, 5) = scrptFile.Size / 1024
Cells(R, 6) = scrptFile.DateCreated
Cells(R, 7) = scrptFile.DateLastModified
Cells(R, 8) = scrptFile.DateLastAccessed
Next
'フォルダ
For Each scrptFldr In zzFSO.GetFolder(FindTopPath).SubFolders
R = R + 1
Cells(R, 1) = "D"
If Right$(FindTopPath, 1) <> "\" Then
Cells(R, 3) = FindTopPath & "\" & scrptFldr.Name
Else
Cells(R, 3) = FindTopPath & scrptFldr.Name
End If
Cells(R, 4) = "○"
Cells(R, 5) = scrptFldr.Size / 1024
Cells(R, 6) = scrptFldr.DateCreated
Cells(R, 7) = scrptFldr.DateLastModified
Cells(R, 8) = scrptFldr.DateLastAccessed
'ネスト
If zzNextFlag = True Then
FindPath = FindPath(scrptFldr.Path)
If FindPath <> "" Then
Exit Function
End If
Else
End If
Next
Exit Function
Err_FindPath:
If zzFldrName1 <> FindTopPath & scrptFldr.Name Then
zzCountX = zzCountX + 1
Cells(R, 3) = FindTopPath & "\" & scrptFldr.Name
Cells(R, 4) = "●"
Cells(R, 6) = scrptFldr.DateCreated
Cells(R, 7) = scrptFldr.DateLastModified
Cells(R, 8) = scrptFldr.DateLastAccessed
End If
zzFldrName1 = FindTopPath & "\" & scrptFldr.Name
Resume Next
End Function
<追記>
宜しければ、参考URL配下の「UiK4010 ファイル検索.xls」をダウンロードし試行してみて下さい。
⇒便利ツール⇒UiK4010 ファイル検索.xls
以上
お礼
ありがとうございます。 参考にさせていただきました。 ご丁寧な回答、感謝いたします。