Method: Remove for DocumentProperties <Data>
- Updated2024-09-12
- 2 minute(s) read
Methods > Method: Remove for DocumentProperties <Data>
Method: Remove for DocumentProperties <Data>
Deletes a custom property of a document. Custom properties are user-defined meta properties from the top level of a document. You can read, create, edit, and delete custom properties. You can only read the other meta properties of a document and edit their values.
A document may be an Office file in XML format or a PDF, JPEG, PNG, or TIFF file, which uses XMP. Use the OpenDocument command to open a document.
Object.Remove(NameOrIndex)
| Object | DocumentProperties <Data> Object with this method |
| NameOrIndex | Variant Specifies the name or the index of the custom property. |
The following example checks a PDF for the custom property copyright and deletes it.
| VBScript | Python |
Dim oMyDocument, oMyProperty, oMyProperties, sOut Set oMyDocument = OpenDocument(ProgramDrv & "Manuals\DIAdem_GettingStarted.pdf",False, eDocumentTypeAuto) Set oMyProperties = oMyDocument.Properties For each oMyProperty in oMyProperties sOut = sOut & "Name: " & oMyProperty.Name & ", Value: " & oMyProperty.Value & VBCrLf Next sOut = sOut & VBCrLf & "==After removing custom property==" & VBCrLf If oMyProperties.Exists("copyright") Then Call oMyDocument.Properties.Remove("copyright") End If For each oMyProperty in oMyProperties sOut = sOut & "Name: " & oMyProperty.Name & ", Value: " & oMyProperty.Value & VBCrLf Next Call MsgBox(sOut)