Public Sub AddGift()

   Dim oGift As CGift

   Dim oUtility As IBBUtilityCode

   Dim oServices As REServices

   Dim oMG As IBBMatchingGift


   Set oServices = New REServices

   oServices.Init REApplication.SessionContext

   Set oUtility = oServices


   Set oGift = New CGift


   With oGift

       .Init REApplication.SessionContext

       .Fields(GIFT_fld_Constit_ID) = 733

       .Fields(GIFT_fld_Amount) = 300

       If oUtility.FundUseShortDesc Then

           .Fields(GIFT_fld_Fund) = "SBSF"


           .Fields(GIFT_fld_Fund) = _

               oUtility.GetFundDescription(oUtility.GetFundID("SBSF", True))

       End If

       .Fields(GIFT_fld_Date) = "9/24/2006"

       .Fields(GIFT_fld_Type) = "Cash"

       If oGift.MatchingGifts.Count > 0 Then

           For Each oMG In oGift.MatchingGifts

               'This line will default the matching gift to have the same

               'field values as the gift given by the constituent


               'If you just want to delete the matching gifts use the line below

               'oGift.MatchingGifts.Remove oMG

           Next oMG

           Set oMG = Nothing

       End If



   End With

   Set oGift = Nothing

   Set oUtility = Nothing



   Set oServices = Nothing

End Sub

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. Our Customer Support can help explain the functionality of a particular procedure, but we will not modify, or assist you with modifying, these examples to provide additional functionality. If you are interested in learning more about the VBA and API modules, contact your account manager.