LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Scan a Directory


Hi!
I'd like to scan a directory and report all files present in it in a
list box.
I use this code (found on this wonderful site) but if I launch this
macro excel goes in crash.
Could you help me, please?

With Application.FileSearch
..NewSearch
..LookIn = "c:\data\h3g"
..Filename = "*.*"
..SearchSubFolders = IncludeSubFolder
..FileType = msoFileTypeAllFiles
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) = 0 Then Exit Sub
For FileCount = 1 To .FoundFiles.Count
lb_Dash.AddItem (.FoundFiles(FileCount))
Next FileCount
..FileType = msoFileTypeExcelWorkbooks ' reset filetypes
End With


--
jjresti
------------------------------------------------------------------------
jjresti's Profile: http://www.excelforum.com/member.php...o&userid=27103
View this thread: http://www.excelforum.com/showthread...hreadid=466189

 
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
Scan directory and import file conditionaly Michael.Tarnowski Excel Worksheet Functions 3 March 30th 09 02:00 PM
how do i fax a scan k Excel Discussion (Misc queries) 4 March 26th 09 03:35 PM
open in old directory save in new directory tim64[_2_] Excel Programming 0 June 15th 05 07:48 PM
Creating a macro that lists directory names within a directory.... Andy Excel Programming 4 November 28th 04 06:13 AM
Check if directory empty OR no of files in directory. Michael Beckinsale Excel Programming 2 December 4th 03 10:12 PM


All times are GMT +1. The time now is 04:00 AM.

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

About Us

"It's about Microsoft Excel"