How do I use the Developer Kit to call Crystal
Ball from Visual Basic Applications?
The following section was inadvertently left out
of the Developer Kit User Manual , Version
2.1.
Calling Crystal Ball from Visual Basic for Applications (VBA)
programs
To call Crystal Ball macros from VBA programs, you
must first make sure that the following two conditions are true:
- Crystal Ball must be running.
- The VBA program must have a reference to Crystal
Ball.
To create a reference to Crystal Ball from your program,
follow these steps:
- Open the module with your VBA program.
- In the menu, select Tools/References.
- Check CB.XLA.
- Click on OK.
If you don't create a reference to CB.XLA, Crystal
Ball macros will not be visible from your VBA program.
If you want your program to automatically load Crystal
Ball, you should launch Crystal Ball from your Auto_Open subroutine.
Do the following:
Sub Auto_Open()
If ExecuteExcel4Macro("ISERROR(CB.Normal(1,1))") Then
CB.Auto_Open
End If
'Your initialization code here
End Sub
This will check to see if Crystal Ball is already
loaded; if it is not loaded, this routine loads it. If you do not
include the above procedure, be sure that Crystal Ball is loaded
when you call its macros.
|