This tip demonstrates how to remove all FGDC-related metadata content from a metadata record while leaving any thumbnails, enclosures, or other metadata content intact.
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 DeleteFGDCContent()
Dim pGxApp As IGxApplication
Dim pGxView As IGxView
Dim pMD As IMetadata
Dim pPS As IPropertySet
Dim dNow As Date
Set pGxApp = Application
Set pMD = pGxApp.SelectedObject
Set pPS = pMD.Metadata
' delete the seven sections that contain FGDC metadata
' elements and all of their contents - including any
' custom elements based on the FGDC metadata standard
' that were added into these sections
pPS.RemoveProperty "idinfo"
pPS.RemoveProperty "dataqual"
pPS.RemoveProperty "spdoinfo"
pPS.RemoveProperty "spref"
pPS.RemoveProperty "eainfo"
pPS.RemoveProperty "distinfo"
pPS.RemoveProperty "metainfo"
' set the time that the metadata was modified, then
' save the changes
dNow = Now
pPS.SetProperty "Esri/ModDate", Format(dNow, "yyyymmdd")
pPS.SetProperty "Esri/ModTime", Format(dNow, "HhNnSs") & "00"
pMD.Metadata = pPS
Set pGxView = pGxApp.View
If TypeOf pGxView Is IGxDocumentationView Then
pGxView.Refresh
End If
End Sub