Dim fs As Object
Set fs = CreateObject("Scripting.FileSystemObject")
Dim folder As Object
Set folder = fs.GetFolder(ThisWorkbook.path)
Dim file As Object
Dim sKey As String
Dim fileDate As Date
For Each file In folder.Files
If file.DateCreated > fileDate Then
fileDate = file.DateCreated
'sKey = file.Name // this works but I want next line instead
sKey = file.BuiltinDocumentProperties("Keywords").Value // Error is here
End If
Next file
Error: object doesn’t support this property or method.
By the Way, this works:
MsgBox ThisWorkbook.BuiltinDocumentProperties("Keywords").Value
If you are not opposed to opening the workbook, that is probably the easiest route:
Alternately, there is a method which does not require the workbook to be opened, but requires a dll to be downloaded.