![]() |
contents of folder
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 |
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 |
contents of folder
Hi Bernie!
Works Fine! Thnx very much! Mark -----Original Message----- 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 . |
All times are GMT +1. The time now is 03:53 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com