This tip demonstrates how to delete all enclosures from the metadata at once without altering the rest of the metadata content.
This macro doesn't verify that the selected object supports metadata, whether it already has metadata, or whether the metadata is writable.
How to use
- Paste this macro into VBA.
- Select an object in ArcCatalog that has metadata.
- Run the macro.
Sub DeleteAllEnclosures()
Dim pGxApp As IGxApplication
Dim pGxView As IGxView
Dim pMD As IMetadata
Dim pXPS As IXmlPropertySet
Dim pPS As IPropertySet
Dim dNow As Date
Set pGxApp = Application
Set pMD = pGxApp.SelectedObject
Set pXPS = pMD.Metadata
' delete regular and image enclosures in the metadata -
' the last parameter must be true to delete all information
' associated with the enclosure such as its description
pXPS.DeletePropertyByAttribute "EsriPropertyType", "Base64", True
pXPS.DeletePropertyByAttribute "EsriPropertyType", "Image", True
' set the time that the metadata was modified, then
' save the changes
Set pPS = pXPS
dNow = Now
pPS.SetProperty "Esri/ModDate", Format(dNow, "yyyymmdd")
pPS.SetProperty "Esri/ModTime", Format(dNow, "HhNnSs") & "00"
pMD.Metadata = pXPS
Set pGxView = pGxApp.View
If TypeOf pGxView Is IGxDocumentationView Then
pGxView.Refresh
End If
End Sub