Select to view content in your preferred language

Zoom To Layer

1022
2
07-22-2010 08:56 AM
CK
by
Emerging Contributor
Hi!
Does anyone know the code (VBA) of the GIS function "Zoom To Layer"?
0 Kudos
2 Replies
AndrewMay
Emerging Contributor
0 Kudos
AnjalDave
New Contributor
This code will zoom display to extent of first layer in TOC(Table Of Content).

Public Sub ZoomToLayer()
  Dim pMxDoc As IMxDocument
  Dim pMap As IMap
  Dim pActiveView As IActiveView
 
  Set pMxDoc = Application.Document
  Set pMap = pMxDoc.FocusMap
  Set pActiveView = pMap
 
  If pMap.Layer(0) Is Nothing Then Exit Sub
  pActiveView.Extent = pMap.Layer(0).AreaOfInterest
  pActiveView.Refresh
End Sub
0 Kudos