Document.CustomDocumentProperties 屬性 (Word)

傳回 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 支援與意見反應