This project is read-only.

VBA GetIntersection Crash

Nov 5, 2016 at 7:00 AM
Hi all,

I'm currently having an issue trying to return the intersection of two polygons. This is the code I have thus far:
Private Sub Command2_Click()
    Dim sf1 As Shapefile
    Dim sf2 As Shapefile
    Dim sf3 As Shapefile
    Set sf1 = Me.Map1.GetObject(0)
    Set sf2 = Me.Map1.GetObject(1)

    Set sf3 = sf1.GetIntersection(False, sf2, False, SHP_NULLSHAPE) 'Crashes
    Me.Map1.AddLayer sf3, True
    Me.Map1.RemoveLayer (0)
    Me.Map1.RemoveLayer (1)
End Sub
Any help would be greatly appreciated.