Document.CustomDocumentProperties プロパティ (Word)

指定したドキュメントのすべてのカスタム ドキュメント プロパティを表す DocumentProperties コレクションを返します。

構文

CustomDocumentProperties

expression 必須です。 Document オブジェクトを表す変数を指定します。

注釈

BuiltInDocumentProperties プロパティを使用して、組み込みのドキュメント プロパティのコレクションを取得します。

msoPropertyTypeString 型 (MsoDocProperties) 型のプロパティは、長さが 255 文字を超えることはできません。

コレクションの 1 つのメンバーを返す方法については、「コレクション からオブジェクトを返す」を参照してください。

次の使用例は、作業中の文書の末尾にカスタム ドキュメント プロパティの一覧を挿入します。

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 のサポートおよびフィードバックを参照してください。