Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Folder Contents to Excel | Excel Discussion (Misc queries) | |||
Listing Folder Contents into a Column | Excel Worksheet Functions | |||
Listing the contents of a folder | Excel Discussion (Misc queries) | |||
add a folder to c:\ drive from cell A1 contents... | Excel Discussion (Misc queries) | |||
Move Folder Contents | Excel Programming |