Sub Point_Grid_Origin() 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 On Error GoTo EH 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\zz1.shp" 'point_grid_origin.shp" Set pOutFeatureClass = ET.PointGrid(sOutFileName, pMapSref, _ "Rect", pEnvelope.LowerLeft.X, pEnvelope.LowerLeft.Y, _ 100, 200, 1, 1, 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