View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default contents of folder

Mark,

Try the macro below - change the path as needed.

HTH,
Bernie
MS Excel MVP

Sub DisplayFilesInMessageBox()
Dim myStr As String
With Application.FileSearch
.NewSearch
.LookIn = "C:\Excel"
.SearchSubFolders = False
.FileType = msoFileTypeExcelWorkbooks
If .Execute() 0 Then
If .FoundFiles.Count 1 Then
MsgBox "There were " & .FoundFiles.Count & " file(s) found."
For i = 1 To .FoundFiles.Count
myStr = myStr & vbTab & _
.FoundFiles(i) & vbTab & _
FileDateTime(.FoundFiles(i)) & vbTab & _
FileLen(.FoundFiles(i)) & Chr(10) & Chr(10)
Next i
End If
MsgBox myStr
End If
End With
End Sub


"Mark" wrote in message
...
Hi,
How display in msgbox contants (files' name in column) of
some folder?
Exist one condition: if files (in folder) is more than 2
then show msgbox with info about files.
Regards
Mark