Skip to main content

Workbook.CustomDocumentProperties property

Table of contents
  1. Syntax
  2. Remarks
  3. Example

Returns or sets a DocumentProperties collection that represents all the custom document properties for the specified workbook.



expression A variable that represents a Workbook object.


This property returns the entire collection of custom document properties. Use the Item method to return a single member of the collection (a DocumentProperty object) by specifying either the name of the property or the collection index (as a number).

Because the Item method is the default method for the DocumentProperties collection, the following statements are identical.


Use the BuiltinDocumentProperties property to return the collection of built-in document properties.

Properties of type msoPropertyTypeString (MsoDocProperties) cannot exceed 255 characters in length.


This example displays the names and values of the custom document properties as a list on worksheet one.

rw = 1
For Each p In ActiveWorkbook.CustomDocumentProperties
    Cells(rw, 1).Value = p.Name
    Cells(rw, 2).Value = p.Value
    rw = rw + 1

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>