Using Office Functions in the BB Hosted versions

Options
Hi there,


has anyone successfully created a calculated field inside of a word merge export letter template?


Additionally, has anyone tried using the VBA code insert feature available for Excel spreadsheet exports?


Is there Blackbaud documentation on how to use the VBA feature?

Comments

  • Carrie Powell
    Carrie Powell ✭✭✭✭✭
    Fifth Anniversary Facilitator 2 Name Dropper Photogenic
    Hi Karintha,


    I have a feeling that you will run into issues trying to insert any Microsoft coding into your Word documents in the hosted environment. I have had an open ticket with Blackbaud support for the past several weeks because I get security warnings that macros are no longer enabled (and I wasn't even trying to use a macro, just the fields available in the Word add-in provided by Raiser's Edge!). I drilled down in the settings (our hosted version has Office 2016, whereas we use 2019 on our own workstations) and found an outdated security certificate, but Blackbaud insists that's not the reason these functions are no longer working and instead indicate that they no longer allow macros. I've been able to find a workaround to use Mail merge in a different way, and I heard from the support rep that they are still looking into similar issues so perhaps there is a resolution coming.


    I don't work with VBA codes, but my suspicion is that it will fall into the same category and you may get an error message.

  • Thank you Carrie Powell‍! I had no trouble with the standard merge fields but suspected there would be trouble trying to go any further with this.

  • Hi Karintha,

    I agree with Carrie that specific coding (like VBA) will run into issues--especially if it needs the permission for a macro to execute. That said, there is quite a bit that can be done with built-in Microsoft fields that can do some level of calculation. For instance, we have been successful in taking split gifts and having them add together if they meet certain criteria. It can look messy from a programmatic standpoint (this is definitely a very niche use of Microsoft Word), but it is possible to do with certain limitations. This is also available in word documents that are not macro-enabled. What type of things are you looking to do in a calculated field?
  • Dariel Dixon 2
    Dariel Dixon 2 ✭✭✭✭✭
    Seventh Anniversary Facilitator 4 Name Dropper Photogenic
    I've been able to do some conditional coding in a template using code tables, but I've never attempted to create a calculated field in a word template. You may have to create a export file and perform the merge on your local computer.
  • Kevin Hatcher‍ , your split gift scenario is I think similar to my circumstance - I've got multiple pledges outputting to a billing statement. I'd like to sum pledges together and subtract pledge balances from pledge amounts.


    Also have to at the end be able to sum all pledge balances to output a total/final outstanding balance number.


    Example (calc fields in bold font):


    John Doe


    Billing category 1
    Pledge 1 ----------------------- $1,000 (300 paid, current balance 700)

    Pledge 2 ----------------------- $500 (150 paid, current balance 350)

    Starting balance ----------- $1,500 (Sum of pledge 1 and pledge 2)

    Payments/Credits --------- $450 (Starting balance/pledge amounts - pledge balances)

    Outstanding Balance ---- $1,050 ( Sum of balances for both pledges)



    Billing Category 2


    Pledge 1 ----------------------- $7,000 (3,000 paid, current balance 4,000)


    Pledge 2 ----------------------- $800 (200 paid, current balance 600)





    Starting balance ----------- $7,800


    Payments/Credits --------- $3,200


    Outstanding Balance ---- $4,600

    Total Outstanding Balance ------------------------- $5,650 (sum of all pledge balances)


    The funds these pledges populate from are not static for every constituent which is why all the calculation has to be done on each statement.
  • With our method, first thing you will want to use is the SET field code. This is because many of the fields that are currency or integers gets pushed out to Word as text fields. I've provided an untested version to show what I think the starting balance would look like.

    1) At the top of your Word document use the SET field code to make sure your amount and integer fields are set correctly and not as text (typically what RE pushes out to Word). You will want to use Alt+F9 to see all the field code logic in Microsoft Word.

    Example: {QUOTE {SET Val1 {MERGEFIELD PLEDGE_1}}{SET Val2 {MERGEFIELD PLEDGE_2}}} (Please note that any bracket is a special character in MS Word that indicates that it is a field code. You can do this by Ctrl+F9.)

    -- The QUOTE just helps keep everything together. The first SET field code tells MS Word that the new field called "Val1" is set to equal the first pledge mergefield. The second SET field code tells MS Word that the new field called "Val2" is set to equal the second pledge mergefield.


    2) Where you wish the calc field to appear, use field codes to add them together.

    Example {QUOTE { ={ =Val1 \\# 0.00}+{ =Val2 \\# 0.00} \\# $#,##0.00}}

    -- "\\# 0.00" tells it that Val 1 and Val2 are to be treated as numbers. The "\\# $#,##0.00" is to be treated as currency. The "=" tells it to expect some form of mathematical operation.


    I will warn that this takes patience as there isn't a good way to test this other than right clicking and toggling the field code (make sure to right click and update field codes after you change something) or even running the merge from the beginning. Hope that helps a bit.
  • Definitely overlooked using SET code, this makes sense.


    Thanks so much! I'll revisit after I've had a chance to test.
  • Bookmarking this post for its very useful content. Thank you, Kevin and Karintha!

Categories