J
Jack Sons
Hi all,
I have the macro below the dotted line that I use to get an alphabetic list
with the content of a directory.
It works like a charm, but I want not only the names of the documents, but
also their date of last change. Preferably in 2 colums, like
ABCD.doc 13-3-2009
thisdocument.DOC 2-11-2004
thisisadocumentwithan
awfullylongname.doc 30-12-2008
etc.
I can't modify the code myself, Your help will be appreciated. I use Office
2k SP 2 with Word 2k.
Thanks in advance.
Jack Sons
The Netherlands
-----------------------------------------------------------------------------------------------------------
Sub Inhoud_Directory()
Dim PathWanted As String
Dim Temp As String
Dim i As Integer
With Dialogs(wdDialogFileOpen)
.Name = "*.*"
If .Display = -1 Then
'Documents.Add
PathWanted = Options.DefaultFilePath(wdDocumentsPath)
Set newdoc = Documents.Add
With newdoc
.Content.Font.Name = "Times New Roman"
.SaveAs FileName:=PathWanted
End With
Selection.TypeText "Files in " & PathWanted & ":" & vbCrLf
With Application.FileSearch
.LookIn = PathWanted
.FileName = "*.*"
If .Execute > 0 Then
For i = 1 To .FoundFiles.Count
Temp = .FoundFiles(i)
While InStr(Temp, "\") > 0
Temp = Mid(Temp, InStr(Temp, "\") + 1)
Wend
Selection.TypeText Temp & vbCrLf
Next
End If
End With
End If
End With
End Sub
I have the macro below the dotted line that I use to get an alphabetic list
with the content of a directory.
It works like a charm, but I want not only the names of the documents, but
also their date of last change. Preferably in 2 colums, like
ABCD.doc 13-3-2009
thisdocument.DOC 2-11-2004
thisisadocumentwithan
awfullylongname.doc 30-12-2008
etc.
I can't modify the code myself, Your help will be appreciated. I use Office
2k SP 2 with Word 2k.
Thanks in advance.
Jack Sons
The Netherlands
-----------------------------------------------------------------------------------------------------------
Sub Inhoud_Directory()
Dim PathWanted As String
Dim Temp As String
Dim i As Integer
With Dialogs(wdDialogFileOpen)
.Name = "*.*"
If .Display = -1 Then
'Documents.Add
PathWanted = Options.DefaultFilePath(wdDocumentsPath)
Set newdoc = Documents.Add
With newdoc
.Content.Font.Name = "Times New Roman"
.SaveAs FileName:=PathWanted
End With
Selection.TypeText "Files in " & PathWanted & ":" & vbCrLf
With Application.FileSearch
.LookIn = PathWanted
.FileName = "*.*"
If .Execute > 0 Then
For i = 1 To .FoundFiles.Count
Temp = .FoundFiles(i)
While InStr(Temp, "\") > 0
Temp = Mid(Temp, InStr(Temp, "\") + 1)
Wend
Selection.TypeText Temp & vbCrLf
Next
End If
End With
End If
End With
End Sub