Tag Archives: VBA

VBA User Fields in Export

In export for a recurring gift it is not possible to pull out the bank details specific to that gift. You can only pull the name of the bank or all the banks on the constituent’s record. It is not possible to pull the account number and sort code. This is really important when there are bank issues with recurring gifts that need to be sorted out.

Continue reading VBA User Fields in Export

Using the Batch API with Notepads or Attributes

I have started to use the Batch API in earnest now. I have said previously that it is a great long overdue piece of functionality but I am beginning to understand why it was never included earlier. As with much of the API the newly added Batch API is not well documented. A good example of how to use it was given and can be found on Blackbaud’s knowledgbase (BB418575) but it is somewhat limited. It does not explain for example how to add an attribute or a notepad to a gift batch. This was discussed on a Blackbus thread.  Adding the items to the batch header was quite straight forward but adding the actual values proved more difficult. Here I try to shed some light on the process.

Continue reading Using the Batch API with Notepads or Attributes

Using the RE Controls – Part 1

There are a lot of controls that The Raiser’s Edge uses and that you can use in your code to give it a similar look and feel. This article is an introduction to using one of these controls – the SuperEdit70Ex. Like most of the API this is not documented. Indeed this really is not documented. There is no extra documentation other than by looking at the object browser.

  Continue reading Using the RE Controls – Part 1

Validating a Constituent Batch

Previously I have integrated Quick Address from QAS with The Raiser’s Edge. I implemented their pro API in order to validate the address on saving the constituent/relationship/participant and on demand using the VBA macro button. I created a plugin to update addresses en masse using their batch API. I implemented their pro API to create a “silent” validation during import. The one thing that I didn’t do at the time was to validate addresses in a constituent batch. At the time this was not a requirement.

Continue reading Validating a Constituent Batch

Integrating with Excel

Two common tasks seem to be integrating RE with an Excel file. This can mean two things. Either from a plugin or some RE:VBA code opening a Excel file and extracting the data or it can mean that from within Excel VBA access the RE objects to retrieve some data. The way you handle the two scenarios is quite different.

 If you are trying to connect to Raiser’s Edge from Excel you will need the API module. You connect to RE using the REAPI object and initialize it with a serial number and optionally user name and password. You then use the API in exactly the same way as you would from within RE, i.e. via VBA or any other API application.

 If you want to open up Excel from RE then you will need to create the application objects. This is shown in the example below:

    Dim objExcel As Excel.Application     ' Excel application 
    Dim objBook As Excel.Workbook      ' Excel workbook  
    Dim objSheet As Excel.Worksheet     ' Excel Worksheet  
    Dim oConstit As New CRecord    oConstit.Init REApplication.SessionContext 
    Set objExcel = CreateObject("excel.application") 'Starts the Excel Session  
    Set objBook = objExcel.Workbooks.Open("C:test.xls")   

    For Each objSheet In objBook.Sheets 
        If UCase(objSheet.Name) = "Sheet1" Then 
            oConstit.Load CLng(objSheet.Range("A2").Text) 
            objSheet.Range("A3").Text = oConstit.Fields(RECORDS_fld_FULL_NAME) 
            Exit For 
        End If 
    Next objSheet 
     objBook.Save  
     If Not objBook Is Nothing Then 
        objBook.Close 
        Set objBook = Nothing 
    End If 
     If Not objExcel Is Nothing Then  
        objExcel.Quit 
        Set objExcel = Nothing 
    End If  

 

This is quite self-explanatory code, although Excel has an object model just as RE does which is very large and takes a while to get to understand. There is plenty of Excel API information on MSDN.