Public Sub AddAutomaticPayment()

  Dim oInd As cSBIndividualRecord
  Dim oPaymentPlan As CAutoPaymentPlan
  Set oInd = New cSBIndividualRecord

  With oInd
   .Init FE_Application.SessionContext
   .Load 6
   Set oPaymentPlan = .AutoPayments.Add

   With oPaymentPlan
       .Fields(AUTOPAYMENTPLANS_fld_DESCRIPTION) = "Adding to test VBA"
       .Fields(AUTOPAYMENTPLANS_fld_ALLOWEFT) = False

        .Schedule.Fields(SCHEDULE_fld_FREQUENCY) = "Monthly"
        .Schedule.Fields(SCHEDULE_fld_MONTHLYDAY) = "6"
       With .Distribution.Add
           .Fields(BBDISTRIBUTIONS_fld_CREDITACCTNUM) = "01-1200-00"
           .Fields(BBDISTRIBUTIONS_fld_AMOUNT) = 1000
       End With
   End With


  End With
  Set oInd = Nothing

End Sub

'Note: You will need to add a reference to Blackbaud FE7.0 Library code for SB/AR (AFNLibSBAR7.dll)
Disclaimer: We provide 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 you are familiar with Microsoft Visual Basic and the tools used to create and debug procedures. Blackbaud Customer Support may help explain the functionality of a particular procedure, but we will not modify, or assist you with modifying, these examples to provide additional functionality.