| 
    
     |  | ファイルの情報を取得しようと、下記のようなコードを組みました。 しかし、このままですとサブフォルダ内のファイルまでは探してくれません。
 
 どのようにしたらサブフォルダ内も探してくれるようになるのでしょうか?
 
 Function FGet(wbp As Variant) As String
 Dim Shl As Object, fol As Object
 Set Shl = CreateObject("shell.application")
 Set fol = Shl.BrowseForFolder(0, "フォルダを選択してください", 0, wbp)
 
 If fol Is Nothing Then
 FGet = ""
 Else
 FGet = fol.items.Item.Path
 End If
 Set fol = Nothing: Set Shl = Nothing
 End Function
 
 Sub ファイル情報取得()
 Dim myfso As New filesystemobject
 Dim myfolder As folder
 Dim myfiles As Files
 Dim myfile As File
 Dim i As Integer
 
 Set myfolder = myfso.getfolder(FGet(Application.ThisWorkbook.Path))
 Set myfiles = myfolder.Files
 For Each myfile In myfiles
 i = i + 1
 Cells(i, 1).Value = myfile.Name
 Cells(i, 2).Value = myfile.datecreated
 Cells(i, 3).Value = myfile.Size
 Next
 
 End Sub
 
 |  |