XLGL and VBA

A question we are receiving more and more lately is: Can XLGL functions be called from VBA (Visual Basic for Application). The answer is Yes.

This is an advanced topic and, if you’re not familiar with VBA, you may be tempted to skip it. However, knowing a little VBA can save you tons of work on repetitive tasks. Starting with this post, we’ll talk more about XLGL and VBA, particularly the ability to create your own Worksheet Functions.

Although XLGL is not fully implement in VBA, it is still possible to call any functions by using Application.Run. For example:

Amount = Application.Run("XGL", "1020")

will return in variable Amount, the current balance of Account 1020.

The first parameter to Application.Run is always the function’s name followed by any function parameter you provide.

Menu command can be called in the same fashion. For example, to recalculate the workbook using XLGL Recalculate command:

Application.Run "XLGL__Recalculate"

To Refresh:

Application.Run "XLGL__Refresh"

This should give you a good head start on using XLGL with VBA. In further posts, we’ll look at custom worksheet function and answer any question we receive on the subject.

Leave a comment