Sub 探す() Dim fso As Object,root As Object Set fso = CreateObject("Scripting.FileSystemObject") ' ルートフォルダを取得して再帰処理スタート Set root = fso.GetFolder("パス") 再帰処理 root End Sub '――――――――――――――――――――――――――――――― Private Sub 再帰処理( ByVal f As Object) Dim file as Object,fpath as string If Instr(f.name,"目的") > 0 Then ' ファイルをチェック For Each file In f.Fileso If InStr(file.Name,"検索値") > 0 Then fpath = file.path Next End if Dim sf as Object ' サブフォルダを再帰処理 For Each sf In f.SubFolders If Instr(sf.name,"コード") > 0 or Instr(sf.name,"書類") > 0 or Instr(sf.name,"分類") > 0 or Instr(sf.name,"yyyymmdd") > 0 Then 再帰処理 sf Next End Sub