Count files in folder
One more way:
Option Explicit
Sub testme()
Dim FSO As Object
Dim myFolder As String
myFolder = "C:\my documents\excel"
Set FSO = CreateObject("Scripting.FileSystemObject")
If FSO.FolderExists(myFolder) Then
activesheet.range("a1").value = FSO.GetFolder(myFolder).Files.Count
End If
End Sub
gmunro wrote:
Hello,
I want to create a macro that will go to a folder, count the excel
documents in it (There will only be excel documents in it if that
helps), go back to my original document and enter the number of files
in a cell.
Is this possible?
--
Dave Peterson
|