How to delete a thumbnail


This tip demonstrates how to delete the thumbnail from the metadata 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

  1. Paste this macro into VBA.
  2. Select an object in ArcCatalog that has metadata.
  3. Run the macro.
[VBA]
Sub DeleteThumbnail()
    
    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 thumbnail from the location where it was placed
    ' with ArcCatalog 8.0
    pPS.RemoveProperty "idinfo/browse/browseem"
    
    ' delete the thumbnail from the location where it is managed
    ' with ArcCatalog 8.1 and newer versions
    pPS.RemoveProperty "Binary/Thumbnail"
    
    ' 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