Word (的 Document.CustomDocumentProperties 屬性)

會傳回代表指定檔之所有自訂文件屬性的 DocumentProperties 集合。

語法

運算式CustomDocumentProperties

需要 expression。 代表 Document 物件的變數。

註解

您可以使用 BuiltInDocumentProperties 屬性可傳回內建文件屬性的集合。

msoPropertyTypeString類型 (MsoDocProperties) 的屬性長度不能超過 255 個字元。

如需傳回集合中單一成員的資訊,請參閱 從集合傳回物件

範例

本範例會在使用中檔的結尾插入自訂文件屬性清單。

Set myRange = ActiveDocument.Content 
myRange.Collapse Direction:=wdCollapseEnd 
For Each prop In ActiveDocument.CustomDocumentProperties 
 With myRange 
 .InsertParagraphAfter 
 .InsertAfter prop.Name & "= " 
 .InsertAfter prop.Value 
 End With 
Next

本範例會將自訂文件屬性新增至Sales.doc。

thename = InputBox("Please type your name", "Name") 
Documents("Sales.doc").CustomDocumentProperties.Add _ 
 Name:="YourName", LinkToContent:=False, Value:=thename, _ 
 Type:=msoPropertyTypeString

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應