PC Review


Reply
Thread Tools Rate Thread

capture directory listings to Excel

 
 
Everett Joline
Guest
Posts: n/a
 
      9th Nov 2003
This is probably a stupid question, but is there some way to capture the
file names, type, and date information from a Windows Explore dialog for use
in Excel?

Thanks,
E-Jo


 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      9th Nov 2003
Here is one I use to get .mp3 files. You probably don't need anything before
'Finds Files
Modify to suit

Sub FindFiles()
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
'sets Erase or Append option
lastrow = Range("a65536").End(xlUp).Row
If lastrow = 4 Then lastrow = 5 Else lastrow = lastrow
'MsgBox lastrow
If UCase([a3]) = "E" Then
Range("a5:f" & lastrow).ClearContents
lastrow = 4
ElseIf UCase([a3]) = "A" Then lastrow = lastrow
End If
'Sets Musicpath
If Right([a1], 1) <> "\" And Left([a1], 1) <> "_" Then x = "\"
If IsEmpty([a2]) = False And Right([a2], 1) <> "\" Then y = "\"
musicpath = [a1] & x & [a2] & y
'Finds Files
With Application.FileSearch
.NewSearch
.LookIn = musicpath
.SearchSubFolders = True 'False
.MatchTextExactly = False
.Filename = ".mp3" '*.mp3* did not work in 97
If .Execute(msoSortOrderDescending) > 0 Then
'MsgBox "There were " & .FoundFiles.Count & " file(s) found."
For i = 1 To .FoundFiles.Count
'MsgBox Mid(.FoundFiles(i), Len(musicpath) + 1, 2)
If Mid(.FoundFiles(i), Len(musicpath) + 1, 2) <> "__" Then 'added for
__INCOMPLETE

x = Application.Find("\", StrReverse(.FoundFiles(i))) - 2 'must have
function before xl2000
y = Application.Find("-", StrReverse(.FoundFiles(i))) - 1

Cells(i + lastrow, 1).Value = Mid(.FoundFiles(i), Len(.FoundFiles(i)) - x,
x - y)
x = Application.Find("-", .FoundFiles(i)) + 1
Cells(i + lastrow, 2).Value = Mid(.FoundFiles(i), x, Len(.FoundFiles(i)) -
x - 3)
Cells(i + lastrow, 3).Value = FileLen(.FoundFiles(i))
Cells(i + lastrow, 4).Value = FileDateTime(.FoundFiles(i))
Cells(i + lastrow, 5).Value = .FoundFiles(i) 'Path to play
End If 'added
Next i

Else
MsgBox "There were no files found."
End If
End With

Range("a5:g" & Range("a65536").End(xlUp).Row) _
..Sort Key1:=Cells(1, 1), Order1:=xlAscending, Key2:=Cells(1, 2),
Order2:=xlAscending, Orientation:=xlTopToBottom
[a5].Select
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub

--
Don Guillett
SalesAid Software
(E-Mail Removed)
"Everett Joline" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> This is probably a stupid question, but is there some way to capture the
> file names, type, and date information from a Windows Explore dialog for

use
> in Excel?
>
> Thanks,
> E-Jo
>
>



 
Reply With Quote
 
Gord Dibben
Guest
Posts: n/a
 
      9th Nov 2003
Everett

Several methods to accomplish this.......

To add a "Print Directory" feature to Explorer, go to
this KB Article.

http://support.microsoft.com/default...EN-US;q272623&

Or you can download Printfolder 1.2 from.....

http://no-nonsense-software.com/freeware/

I use PF 1.2 and find it to be more than adequate with custom features.

OR Go to DOS(Command) prompt and directory.
Type DIR >MYFILES.TXT

All the above create a *.TXT file which can be opened in Excel.

One more method if you want to by-pass the *.TXT file and pull directly to
Excel is to use Tushar Mehta's Excel Add-in.

http://www.tushar-mehta.com/ scroll down to Add-ins>Directory Listing.

Download the ZIP file and un-zip to your Office\Library folder.

Gord Dibben XL2002

On Sun, 9 Nov 2003 10:00:08 -0500, "Everett Joline" <(E-Mail Removed)>
wrote:

>This is probably a stupid question, but is there some way to capture the
>file names, type, and date information from a Windows Explore dialog for use
>in Excel?
>
>Thanks,
>E-Jo
>


Gord Dibben XL2002
 
Reply With Quote
 
Everett Joline
Guest
Posts: n/a
 
      9th Nov 2003
Thanks Don and Gord for your detailed responses. I'm not fluent in VBA at
the moment so I opted for the first method listed by Gord. Actually there is
a slightly different version for Win2K and XP described under KB 321379.

The only problem is that it works fine going to the default printer, but I
don't know how to make it print to a file since no print dialog comes up
(where I could check 'print to file').

How do I make it do that?

Thanks again,
E-Jo

"Everett Joline" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> This is probably a stupid question, but is there some way to capture the
> file names, type, and date information from a Windows Explore dialog for

use
> in Excel?
>
> Thanks,
> E-Jo
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Folder/Directory listings saved in Excel? Paddy O''Moron Microsoft Excel Misc 1 24th Nov 2009 04:25 PM
Slow directory listings =?Utf-8?B?SlI=?= Microsoft Windows 2000 3 28th Jan 2007 08:57 PM
FTP Parsing directory listings Gina_Marano Microsoft C# .NET 2 4th Nov 2006 03:12 PM
Thumbnailer for Directory Listings swross36@yahoo.com Freeware 0 26th Feb 2005 10:45 PM
Directory listings tgoodner Microsoft Windows 2000 Advanced Server 0 23rd Aug 2004 09:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:55 PM.