K
Kara
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
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