I found this code to check if a folder has files in it but I need to check if the folder has a sub folder in it, how can I do this in Excel 2003
Thanks
Thanks
Code:
Dim fs, strFolderPath, oFolder
Set fs = CreateObject("Scripting.FileSystemObject")
strFolderPath = "d:\" ' this is your folder
Set oFolder = fs.GetFolder(strFolderPath)
If (oFolder.Files.Count = 0) Then
'folder is Empty
MsgBox "folder's empty"
Else
' folder isn't empty
MsgBox "folder not empty. Files count: " & oFolder.Files.Count
End If
Set fs = Nothing