Jon von der Heyden
MrExcel MVP, Moderator
- Joined
- Apr 6, 2004
- Messages
- 10,912
- Office Version
- 365
- Platform
- Windows
Hi
I realise that this isn't strictly Excel, but I have seen vbs been used before so I'm hoping someone can assist. I have a problem with following code... It loops thru all subfolders correctly but I want to return the properties of the files housed within the folders.
I think the problem is here:
I have noticed that this still only looks at File Folders and not the actuals files (e.g. .xls, .pdf etc.)
Any help?
Thanks
Jon
I realise that this isn't strictly Excel, but I have seen vbs been used before so I'm hoping someone can assist. I have a problem with following code... It loops thru all subfolders correctly but I want to return the properties of the files housed within the folders.
Code:
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objLogFile = objFSO.CreateTextFile("C:\ScriptLog.txt")
LoopSubFolders objFSO.GetFolder("H:\")
Sub LoopSubFolders(Folder)
For Each SubFolder in Folder.SubFolders
LoopSubFolders SubFolder
If SubFolder.Size > 10240 Then
For Each objFile in Folder.SubFolders
objLogFile.WriteLine objFile.Type
Next
End If
Next
End Sub
I think the problem is here:
Code:
For Each objFile in Folder.SubFolders
I have noticed that this still only looks at File Folders and not the actuals files (e.g. .xls, .pdf etc.)
Any help?

Thanks
Jon