Print Out List of Excel Files in My Documents

J

John Yount

Is there a way to print out a list of all of my Excel
files in the My Documents folder? I am trying to do some
maintenance-delete or backup to disk and then delete some
unnecessary, old files, etc. It would help if I could
print a list and plan my maintenance, but I don't see a
way to do this. Can anyone help? Thanks.
 
R

Ron de Bruin

Try this on a empty sheet
Change the path

.LookIn = "C:\"


Sub test()
Dim I As Integer
With Application.FileSearch
.NewSearch
.LookIn = "C:\"
.FileType = msoFileTypeExcelWorkbooks
.SearchSubFolders = False
If .Execute > 0 Then
For I = 1 To .FoundFiles.Count
Range("A" & I).Value = .FoundFiles(I)
Next I
Else
MsgBox "No files found."
End If
End With
End Sub
 
V

Vasant Nanavati

This is very easy to do in DOS. Open a DOS window using Start | Run | cmd.
Then navigate to the My Documents folder using the cd (Change Directory)
command. Once you are there, type in:

dir *.xls > filename.txt

A file with that name will be created in the folder containing all the
information you want. You can print it, open it in Excel, sort it, whatever.
 
G

Gord Dibben

John

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

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

http://support.microsoft.com/default.aspx?scid=KB;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. This allows filtering and
sorting once you have the data in Excel.

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 Excel MVP
 
R

RagDyer

Quick and "dirty":

Open windows explorer and navigate to the file in question.
Hit "PrintScreen", and then open Word.
Right click in new doc and choose "Paste".
--

HTH,

RD
==============================================
Please keep all correspondence within the Group, so all may benefit!
==============================================

Is there a way to print out a list of all of my Excel
files in the My Documents folder? I am trying to do some
maintenance-delete or backup to disk and then delete some
unnecessary, old files, etc. It would help if I could
print a list and plan my maintenance, but I don't see a
way to do this. Can anyone help? Thanks.
 
H

Harlan Grove

This is very easy to do in DOS. Open a DOS window using Start | Run | cmd.
Then navigate to the My Documents folder using the cd (Change Directory)
command. Once you are there, type in:

dir *.xls > filename.txt

A file with that name will be created in the folder containing all the
information you want. You can print it, open it in Excel, sort it, whatever.

Quibbles: could just do the whole thing from Start > Run, may want to include
files in subdirectories, and the default DIR output is messy.

Perhaps from Start > Run,

cmd /c dir "C:\My Documents\*.xl?" /s/b > %TEMP%\filelist.prn
 
H

Harlan Grove

Is there a way to print out a list of all of my Excel
files in the My Documents folder? I am trying to do some
maintenance-delete or backup to disk and then delete some
unnecessary, old files, etc. It would help if I could
print a list and plan my maintenance, but I don't see a
way to do this. Can anyone help? Thanks.

Another option, this one a UDF.


Function FileList(mask As String) As Variant
Dim n As Long, s() As String

n = Len(mask)

For n = n To 1 Step -1
If Mid(mask, n, 1) = "\" Then Exit For
Next n

With Application.FileSearch
If n = 0 Then
FileName = mask
LookIn = "."
Else
FileName = Mid(mask, n + 1)
LookIn = Mid(mask, 1, n - 1)
End If

SearchSubFolders = True

Execute msoSortByFileName, msoSortOrderAscending, True
n = .FoundFiles.Count

ReDim s(1 To n, 1 To 1)

For n = n To 1 Step -1
s(n, 1) = .FoundFiles(n)
Next n
End With

FileList = s
End Function
 
B

BrianB

Just a quickie ............
Use Windows Explorer to view files.
Alt + Print Screen to copy
Paste into Word and Print
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top