How do I count the files in a folder?
Thanks,
Sir Loin
Printable View
How do I count the files in a folder?
Thanks,
Sir Loin
Here you go.
The easy way is to use FileSystemObject (scripting library):
The better way is to use Windows API but this also means much more coding.VB Code:
Private Sub Command1_Click() '=============================== Dim fso As New FileSystemObject Dim fldr As Folder Set fldr = fso.GetFolder("c:\windows") MsgBox "Total files in the folder: " & fldr.Files.Count End Sub
Nice, thank you! :)