Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2005

Tip: Looking for answers? Try searching our database.

Word Macro to list File Names, Size, and Modify Date

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kara - 06 Oct 2005 18:10 GMT
Below is a Macro that I found to list the File Names of all of the files in a
directory.  How can I add File Size and Date to that list?

Thanks for your help!

Kara

Sub FileNames()

Dim MyPath As String
Dim MyName As String

'let user select a path
With Dialogs(wdDialogCopyFile)
   If .Display() <> -1 Then Exit Sub
   MyPath = .Directory
End With

'strip quotation marks from path
If Len(MyPath) = 0 Then Exit Sub

If Asc(MyPath) = 34 Then
   MyPath = Mid$(MyPath, 2, Len(MyPath) - 2)
End If

'get files from the selected path
'and insert them into the doc
MyName = Dir$(MyPath & "*.*")
Do While MyName <> ""
   Selection.InsertAfter MyName & vbCr
   MyName = Dir
Loop

'collapse the selection
Selection.Collapse wdCollapseEnd

End Sub
Doug Robbins - 06 Oct 2005 20:55 GMT
See the article "Getting access to the Document Properties of a Word file"
at:

http://www.word.mvps.org/FAQs/MacrosVBA/DSOFile.htm

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Below is a Macro that I found to list the File Names of all of the files
> in a
[quoted text clipped - 34 lines]
>
> End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.