如何获得最后创build的书的属性而不是ThisWorkbook?

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 

错误:对象不支持此属性或方法。
顺便说一下,这工作:

 MsgBox ThisWorkbook.BuiltinDocumentProperties("Keywords").Value 

如果你不反对打开工作簿,这可能是最简单的路线:

 Dim wb As Workbook Set wb = Workbooks.Open(filename:=file.Name, ReadOnly:=True) skey = wb.BuiltinDocumentProperties("Keywords").Value wb.Close (False) 

或者,有一种方法不需要打开工作簿 ,但需要下载dll 。