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.
Note: To successfully integrate API applications with The Raiser’s Edge, you should include three critical features in your programming: reference The Raiser’s Edge type library, follow proper declaration (startup, terminate, and close down methods), and successfully access the program database.
API Guidelines
  1. Start the COM enabled Programming Application (VB6, C++, Java, etc.).
  2. Set References to the Type Library for The Raiser's Edge 7 (Blackbaud Raiser's Edge 7 Objects) and any other applications with which you need to interface. The primary file to reference is BBREAPI.dll.
    • For Microsoft .NET the location will be {Root Raiser’s Edge 7 install location}\Blackbaud\The Raisers Edge 7\PIA
    • For other platforms the location will be {Root Raiser’s Edge 7 install location}\Blackbaud\The Raisers Edge 7\dll and {Root Raiser’s Edge 7 install location}\Blackbaud\The Raisers Edge 7\tlb
  3. Set The Raiser's 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 Raiser's Edge 7, it must identify itself to The Raiser's Edge 7 and pass the standard security checks before access is granted. This is accomplished in three steps:

Accessing and Initializing the RE API

Step 1: Declare a reference to the REAPI
To connect with The Raiser’s Edge through the API, you must create a global object reference to the REAPI object. This reference should be global because it is created and initialized only once when you start the program. It is important you maintain a reference to the API object throughout the lifetime of your program.

Example: Private moAPI As REAPI
Tip: 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.
Step 2: Create a new instance of the REAPI object
At the end of your program, you must clear the reference to remove the object from memory.

Example: set moAPI = New REAPI

Step 3: Initialize the REAPI object and identify the API application
To use the REAPI object, you must call the REAPI.Init method just after the application startup. The API object has an Init function for this purpose. This function has a Boolean return type, indicating the result of the connection attempt.

REAPI.Init (sSerialNumber As String, [sUserName As String], [sPwd As String], [DatabaseNumber As Long], [sThirdPartyVendor as String], [1AppMode = amStandalone or amServer]) As Boolean

sSerialNumber. Required. Enter your unique RE database serial number here. 

sUserName. Optional. A string expression containing a valid user name for The Raiser’s Edge database for which you are attempting to connect. Note: If the User name and Password fields are blank, the login form appears when the Init method runs.

sPwd. Optional. A string expression containing a valid password for the user name specified above. Note: If both the User name and Password are supplied, the login form does not display.

DatabaseNumber. Optional. A long expression representing the position of the desired database within the login list. Note: The standard sample database is always represented by 50. The first live database is usually represented by 1. If the optional parameter is not defined, the database window appears to the user, enabling them to select the desired database.

sThirdPartyVendor. Optional. Reserved for third party vendors.

1AppMode. Optional. A long expression indicating whether this application is operating standalone or as a server. If omitted, The Raiser’s Edge assumes this is a standalone application. A standalone install is set up for one user and workstation, while a amServer installation configures the application for multiple users and workstations.

Example 1: RE7.Init("WRE11111","Supervisor","admin",50,"",AppMode.amServer) ''App installed on a server to be accessed by multiple users
Example 2: RE7.Init("WRE11111","Supervisor","admin",50,"",AppMode.amStandalone) ''App installed on a workstation to be accessed by one user at a time

Once the REAPI object is properly accessed and initialized, you can use it to initialize any of the other Raiser's Edge 7 specific objects in the same way you use the REApplication object from within VBA.

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

Private moRecord As CRecord
Set moRecord = New CRecord
moRecord.Init moAPI.SessionContext

REAPI Object Properties and Methods

There are several additional properties and methods that are available with the REAPI object. Each of the properties and methods allow you to get additional information from your database.

AppMode Property. This is a read-only property you can use to determine whether the application is a standalone (default) or network instance. The API object does not need to be initialized to access this method.

GetAvailableRegistryKeys Method. This method returns an array containing the registry key root for each installed Raiser’s Edge database. Note: If you have multiple Raiser’s Edge databases installed with API support, you can use this method to present the end-user with a list of available databases.

LastErrorMessage Property. This is a read-only property you can use to display the reason for an Init method failure 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.