0
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
4

1 に答える 1

5

ワークブックを開くことに抵抗がない場合は、おそらくこれが最も簡単な方法です。

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

または、ワークブックを開く必要はなくdll をダウンロードする必要がある方法もあります。

于 2012-09-13T19:42:22.340 に答える