For an external application to be programmed using VBA or API, that application must have an existing API of its own. For instance, most Microsoft applications (Excel, Access, Outlook, Word, etc.) have both a VBA for internal customization (i.e., macros) and an API that can be accessed from outside of the program.

API Guidelines

  1. Start the COM enabled Programming Application (VB6, C++, Java, etc.).
  2. Set References to the Type Library for The Financial Edge 7 (Blackbaud FE7.0 Objects) and any other applications with which you need to interface.
  3. Set The Financial Edge 7 ActiveX controls/components (if necessary).

You can take most code written in VBA and convert it to code for API simply by changing a few variables and adding API specific code for database security. Because API runs outside of The Financial Edge 7, it must identify itself to The Financial Edge 7 and pass the standard security checks before access is granted. This is accomplished in three steps:

Initializing the API

  • Declare a reference to the FE_API.
    Private moFE_API As FE_API

    This line is usually in the General Declarations section, where it can be declared as a module-level variable so that you can easily call it from anywhere in the code.

  • Create a new instance of the FE_API object.
    Set moFE_API = New FE_API
  • Initialize the FE_API object and identify the API application.
    'Initialize the FE API object and attempt to connect to the FE_7 sample database
    If Not moFE_API.Init("", "Supervisor", "Password", 50) Then
       MsgBox "Cannot connect to the database", vbOKOnly or vbInformation
       Exit Sub
    End If

    The Init method of the API has the following parameters:

    ParameterVariable TypeDescription
    Serial NumberTextAn API serial number for security clearance.
    User NameTextDefines the login name for this session.
    PasswordTextDefines the password for this session.
    Database NumberLongRepresents the database to which you wish to connect. The sample database is always 50.
    Refer to How to determine what DSN the database is using
    Vendor NameTextIdentifies the application source for this API. (optional)
    Application ModeApplication ModeSpecify whether this code runs as a standalone or a server. (optional)

    Note: If both User Name and Password are included, the API will not prompt for a password.

    Once the FE_API object is properly accessed and initialized, you can use it to initialize any of the other Financial Edge 7 specific objects in the same way you use the FE_Application object from within VBA.

    For example, to initialize a CAPInvoice, you would use code similar to this:

    Dim moRecord As CAPInvoice
    Set moRecord = New CAPInvoice
    moRecord.Init moAPI.SessionContext
For additional information on using the API, please reference The Financial Edge VBA and API Guide.

Contact your account manager for more information on this and other services offered.