This tip demonstrates how to remove all metadata element values, for the selected item, that are currently synchronized through ArcCatalog. The sample looks for the elements that have a "Sync" attributes of 'True', then deletes those from the metadata record.
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 DeleteSyncProperties()
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
pXPS.DeletePropertyByAttribute "Sync", "TRUE", False
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