Public Sub RemoveApplication()
    Dim oPayHeader As CPaymentHeader
    Set oPayHeader = New CPaymentHeader
    oPayHeader.Init FE_Application.SessionContext
   
    oPayHeader.Load 188
   
    Debug.Print oPayHeader.Fields(PAYMENTHEADERS_fld_PAYERNAME)
   
    Dim oPayment As CPayment
    Set oPayment = oPayHeader.BaseComponent
   
    Dim oDistribution As CPaymentDistribution
    Dim oApplication As CARChargeApplication
   
    Debug.Print "****"
    For Each oDistribution In oPayment.PayeeDistribution
        Debug.Print oDistribution.Fields(PAYMENTDISTRIBUTIONS_fld_PAYEENAME)
        For Each oApplication In oDistribution.Applications
       
            Debug.Print oApplication.Fields(CHARGEAPPLICATIONS_fld_AMOUNT)
            oDistribution.Applications.Remove oApplication
            Set oApplication = Nothing
        Next oApplication
        Set oDistribution = Nothing
    Next oDistribution
   
   
    oPayHeader.Save
    oPayHeader.CloseDown
    Set oPayHeader = Nothing
 
End Sub

Blackbaud provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with Microsoft Visual Basic and the tools used to create and debug procedures.  Blackbaud Customer Support can help explain the functionality of a particular procedure but they will not modify, or assist you with modifying, these examples to provide additional functionality.  If you are interested in learning more about VBA and API modules, contact our Sales department at solutions@blackbaud.com.