レイヤーのエクステント取得

'ThisDocumentの取得
Dim pMxDocument As IMxDocument
Set pMxDocument = ThisDocument

'アクティブなデータフレームの取得
Dim pMap As IMap
Set pMap = pMxDocument.FocusMap

'最上位レイヤの取得
Dim pGeoDataset As IGeoDataset
Set pGeoDataset = pMap.Layer(0)

'エンベロープを取得
Dim pEnvelope As IEnvelope
Set pEnvelope = pGeoDataset.Extent

Debug.Print "XMax:" & pEnvelope.XMax
Debug.Print "XMin:" & pEnvelope.XMin
Debug.Print "YMax:" & pEnvelope.YMax
Debug.Print "YMin:" & pEnvelope.YMin