How can execute correctly the function "DeleteCutPlane" in the secondary development about ProStructures?

Can you help me?When I do secondary development about ProStructures,I cannot execute correctly the function "DeleteCutPlane" like the example  as follows:

void PsEditModification::DeleteCutPlane(int handle)

Removes one cutplane from the object. 

Sub Example_DeleteCutPlane()
    ' This example deletes a cutplane from an object by its handle 
    Dim EditModify As New PsEditModification
    Dim Selection As New PsSelection
    Dim Id, Count, EHandle As Long

    Id = Selection.PickObject("Pick an object")

    EditModify.SetObjectId(Id)
    Count = EditModify.CutplaneCount
    If Count = 0 Then
        Exit Sub
    End If

    EHandle = EditModify.GetCutPlaneHandleFromNumber(Count - 1)

    ' Delete the polycut with handle number EHandle 
    EditModify.DeleteCutPlane(EHandle)

End Sub