Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Folder Contents to Excel TC Daniel Excel Discussion (Misc queries) 2 January 23rd 08 05:53 PM
Listing Folder Contents into a Column LyndieBee Excel Worksheet Functions 1 August 29th 07 03:16 PM
Listing the contents of a folder [email protected] Excel Discussion (Misc queries) 2 April 12th 07 03:54 AM
add a folder to c:\ drive from cell A1 contents... [email protected] Excel Discussion (Misc queries) 1 July 25th 06 09:48 PM
Move Folder Contents Dave Peterson[_3_] Excel Programming 2 May 10th 04 03:36 PM


All times are GMT +1. The time now is 08:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"