CustomDocumentProperties Property

An accessor property that returns a Microsoft Office DocumentProperties collection of the specified document's custom properties. Read-only Object.


*expression   * Required. An expression that returns a Document object.


Use BuiltInDocumentProperties and CustomDocumentProperties to return the properties of a document. The built-in properties list includes commonly used fields such as "Title," "Author," and "Creation Date." The custom document properties collection is empty by default.


The following example creates a new document from a file, adds a new custom property to its custom properties collection, and then displays the list of custom properties and their values.

Sub TestCustomDocumentProperties()

  Dim miDoc As MODI.Document
  Dim miDocProps As Office.DocumentProperties
  Dim p As Office.DocumentProperty
  Dim strPropsInfo As String
  Set miDoc = New MODI.Document
  miDoc.Create "C:\document1.tif"
  Set miDocProps = miDoc.CustomDocumentProperties
  miDocProps.Add "MyCustomProperty", False, msoPropertyTypeString, "MyCustomValue"
  For Each p In miDocProps
    strPropsInfo = strPropsInfo & p.Name & _
      ": " & p.Value & vbCrLf
  MsgBox strPropsInfo, vbInformation + vbOKOnly, _
    "Custom Document Properties"
  Set miDoc = Nothing

End Sub

Applies to | Document Object