The problem with imports

One common problem that I have had with writing VBA code that hooks on to the import process is debugging. Unlike the other processes that you can write VBA code for the import process is a modal form. This means that the import window has to be on top at all times and you cannot go back to another window in Raiser’s Edge

 The problem with this is that you cannot set a break point in your code and you cannot step through the code. This makes debugging code difficult.

There are a couple of work arounds.

The first thing to do is to ensure that your code compiles. This may sound obvious but when you work with the import module you do not get any warnings that there is an error in the code. It just fails with the not very useful error message of code interrupted by user (to paraphrase the message). If you compile it before trying to debug it you at least know that there are no compile errors.

The next debug strategy is to put message boxes in the code. This can be useful for letting you know the values of variables along the way and to tell you the path the code takes. You just have to make sure you remove all your message boxes after use.

The final way is to build a VBA DLL to debug. If you have not used this tool before then it is worth while using it as there are various benefits to using it as outlined in my earlier post. The VBA DLL tool is found in the same directory as the RE7.EXE file, most likely C:\Program Files\Blackbaud\The Raisers Edge. This environment is similar to the built in VBA environment except that you can compile the code to a dll. If you set the program to run on debug to The Raiser’s Edge executable you are able to debug your code as RE is loaded and you can start your import as normal. However now your code will stop at break points.

 There are some issues with this tool however. For example there seems to be errors when you try to create certain top level objects from within an import, e.g. a CIndividual2 object. There appear to also be issues with import when you create an exception. Sometimes the exception is created but the custom message is not shown on the control report. Aside from these errors it is well worth using the VBA DLL tool to debug and test code.