View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Count files in a folder

Option Explicit
Sub testme()
Dim myFolderName As String
Dim FSO As Object

Set FSO = CreateObject("Scripting.FileSystemObject")
myFolderName = "C:\My Documents\excel"

If FSO.folderexists(myFolderName) Then
MsgBox FSO.getfolder(myFolderName).Files.Count
Else
MsgBox "no folder!"
End If

End Sub

Wanna Learn wrote:

Hello

Is there a way to count how many files are there in a folder? thanks


--

Dave Peterson