Hi there,
I'm trying to exclude specific file types when doing a count within folders in a specific directory.
The code below works when the file is NAMED, but only when.
I need some guidance on how wildcards would be used in a situation like this.
In addition, I would GREATLY appreciate some help on excluding multiple (ex; .doc, .accdb, etc.) file types within the same routine.
Thanks in advance!
I'm trying to exclude specific file types when doing a count within folders in a specific directory.
The code below works when the file is NAMED, but only when.
I need some guidance on how wildcards would be used in a situation like this.
In addition, I would GREATLY appreciate some help on excluding multiple (ex; .doc, .accdb, etc.) file types within the same routine.
Code:
Folder_Location = "some directory…"
Set F_S_O = CreateObject("Scripting.FileSystemObject")
Last_Row_ColA = ActiveSheet.Cells(ActiveSheet.Rows.Count, "A").End(xlUp).Row
For Loop_Thru = 2 To Last_Row_ColA
AcctNo_Searched = Folder_Location & Range("A" & Loop_Thru).Value
Set Object_Files = F_S_O.getfolder(AcctNo_Searched).Files
File_Count = Object_Files.Count
For Each Ob_Ject In Object_Files
If Ob_Ject.Name = "Thumbs.db" Then
File_Count = File_Count - 1
End If
Next Ob_Ject
Range("C" & Loop_Thru).Value = File_Count
Next
End Sub
Thanks in advance!