Sub Vector_Grid_Extents() Dim pMxDoc As IMxDocument Dim pMap As IMap Dim pActiveView As IActiveView Dim pMapSref As ISpatialReference Dim pFeatureLayer As IFeatureLayer Dim pOutFeatureClass As IFeatureClass Dim sMessage As String Set pMxDoc = ThisDocument Set pMap = pMxDoc.FocusMap Set pActiveView = pMap Set pMapSref = pMap.SpatialReference '======================================================================= Dim ET As ETGW_Core Set ET = New ETGW_Core Dim sOutFileName As String Dim pEnvelope As IEnvelope Set pEnvelope = pActiveView.Extent sOutFileName = "c:\00\zz4.shp" Set pOutFeatureClass = ET.VectorGridExtents(sOutFileName, pEnvelope, pMapSref, _ "Polyline", 100, 50, sMessage) If pOutFeatureClass Is Nothing Then MsgBox sMessage Exit Sub End If '======================================================================== Set pFeatureLayer = New FeatureLayer Set pFeatureLayer.FeatureClass = pOutFeatureClass pFeatureLayer.Name = pOutFeatureClass.AliasName pMap.AddLayer pFeatureLayer Exit Sub EH: MsgBox Err.Description End Sub