mt****@yadtel.net (Dale Ring) wrote in message news:<d5*************************@posting.google.c om>...
There may be several files of several different types in the folder.
All I want to know is: Is the folder empty? Yes or No
<SNIP>
Check out the Dir() function. Something like this:
Public Sub processFolder(sPath As String)
Dim sFileName As String, nID As Long
If Len(Dir(sPath, vbDirectory)) & vbNullString > 0 Then
sFileName = Dir(sPath & "\*.txt", vbNormal)
Do While Len(sFileName) & vbNullString > 0
'<do some processing here>
sFileName = Dir()
Loop
End If
End Sub
So make the sub a function.
This worked for me... your mileage may vary. You'll need the
BrowseFolder API from
www.mpvs.org from the API section.
Option Compare Database
Option Explicit
Private Sub Command0_Click()
Dim sPath As String
sPath = BrowseFolder("What Folder you want to select?")
Me.txtFolder = sPath
MsgBox "Path: " & sPath & " empty: " & IsEmptyFolder(sPath)
End Sub
Public Function IsEmptyFolder(ByVal sPath As String) As Boolean
Dim sFileName As String, nID As Long
IsEmptyFolder = True
If Len(Dir(sPath, vbDirectory)) & vbNullString > 0 Then
sFileName = Dir(sPath & "\*.*", vbNormal)
IsEmptyFolder = (Len(sFileName) & vbNullString = 0)
End If
End Function