A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
David Newmarch,
Try this approach ... Save a new Excel file as .xlsm (macro enable) in a new folder near top of the tree (so file path isn't too long). Copy your Word files into the same folder. Open the Excel file and the VB editor (Alt+F11) and click Tool > References, and select Microsoft Word 12.0 Object Library (if not already selected). Copy the code below into a module and run -- it currently saves the Word doc props into sheet 1 of the Excel file, based on your wishlist.
Sub Wd_Doc_Props()
'
Dim p As String, r As Long, xlWb As Excel.Workbook, xlWs As Excel.Worksheet
Dim wdApp As Word.Application, wrd As String, wdDoc As Word.Document
'
On Error Resume Next
Set wdApp = GetObject(, "Word.Application")
If Err.Number <> 0 Then 'Word isn't already running
Set wdApp = CreateObject("Word.Application")
End If
On Error GoTo 0
'
Set xlWb = Application.ActiveWorkbook
Set xlWs = xlWb.ActiveSheet
'
xlWs.Cells(1, 1) = "Filename"
xlWs.Cells(1, 2) = "Creation date"
xlWs.Cells(1, 3) = "Last save time"
xlWs.Cells(1, 4) = "Total editing time"
xlWs.Cells(1, 5) = "Number of words"
xlWs.Cells(1, 6) = "Number of bytes"
'
r = xlWs.Cells(Rows.Count, "A").End(xlUp).Row + 1
'
p = xlWb.Path
'
wrd = Dir(p & "\*.*")
'
Do While wrd <> ""
'
If Right(wrd, 4) = ".doc" Or Right(wrd, 5) = ".docx" Then
'
Set wdDoc = wdApp.Documents.Open(p & "" & wrd)
'
On Error Resume Next
'
xlWs.Cells(r, 1) = wdDoc.Name
xlWs.Cells(r, 2) = wdDoc.BuiltinDocumentProperties("Creation date").Value
xlWs.Cells(r, 3) = wdDoc.BuiltinDocumentProperties("Last save time").Value
xlWs.Cells(r, 4) = wdDoc.BuiltinDocumentProperties("Total editing time").Value
xlWs.Cells(r, 5) = wdDoc.BuiltinDocumentProperties("Number of words").Value
xlWs.Cells(r, 6) = wdDoc.BuiltinDocumentProperties("Number of bytes").Value
'
r = r + 1
'
wdApp.Documents.Close savechanges = False
'
End If
'
wrd = Dir()
'
Loop
'
wdApp.Quit
'
End Sub
___________
Regards, Tom