How to zoom in within ArcCatalog's preview window


This tip demonstrates some simple code for zooming in a fixed amount on the data being displayed in the Preview window of ArcCatalog.

How to use

  1. Paste this macro into VBA.
  2. Preview a geographic dataset.
  3. Run this macro.
[VBA]
Public Sub ZoomIn()
    Dim pApp As IGxApplication
    Set pApp = Application
    If Not TypeOf pApp.View Is IGxPreview Then Exit Sub
    
    Dim pPreview As IGxPreview
    Set pPreview = pApp.View
    If Not TypeOf pPreview.View Is IGxGeographicView Then Exit Sub
    
    Dim pGeoView As IGxGeographicView, pActiveView As IActiveView, pExtent As IEnvelope
    Set pGeoView = pPreview.View
    Set pActiveView = pGeoView.Map
    Set pExtent = pActiveView.Extent
    pExtent.Expand 0.75, 0.75, True
    pActiveView.Extent = pExtent
    pActiveView.Refresh
End Sub