How to Run Crystal Ball With Visual Basic

Written by divya gupta
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Run Crystal Ball With Visual Basic
Crystal Ball is the leading decision making software by Oracle. (3d graph image by Stuart Bolton from

Crystal Ball is the widely used decision making software from Oracle Corporation. You can use it for forecasting, simulation, optimisation and predictive modelling tasks that help in maintaining competitive advantage. Visual Basic for Applications (VBA) is the programming language used for all the Microsoft Office products. Since Crystal Ball can be accessed from Microsoft Excel as an Add-In, you can use Visual Basic Macros (small functions and subroutines) for running Crystal Ball. Use VBA to perform tasks like multiple simulations at a time, to integrate with other tools and generate customised reports.

Skill level:

Other People Are Reading


  1. 1

    Click Windows "Start" and choose "All Programs." Locate and choose "Crystal Ball" from the available list of programs. The "Crystal Ball" toolbar will appear in Excel Ribbon interface.

  2. 2

    Create your model in Excel. Click "Developer" in the main menu and choose "Visual Basic" to open Microsoft Visual Basic Editor (VB). Alternatively, you can also open VB by pressing "Alt and F11." You will be able to see the code behind the model created in Excel.

  3. 3

    Click "Insert" from the main menu and choose "Insert Module" to open "Module1" screen. You can write your VBA code in this screen.

  4. 4

    Click "Tools" from main menu and select "References" to open the "References -- VBA Project" screen.

  5. 5

    Locate and check-box the option "cb.xla" or "CBDevKit.xla" depending on the version you are using to enable Crystal Ball functions in VB. If you do not find the file in the list of References, locate it using the "Browse..." tab and choosing the appropriate file.

  6. 6

    Write your code in the "Module" window. Call Crystal Ball functions by prefixing "CB" to them. For example, to run a simulation 100 times, you can call function in the following way:

    CB. Simulation 100.

  7. 7

    Close "Visual Basic Editor" once your code is complete by clicking the "X." Click "Macros" in the "Developer" menu to see the list of macros available.

  8. 8

    Click the appropriate macro by highlighting it and select "Run" to execute the macro. You can also assign the macro to a button or any other control like Combo Box.

  9. 9

    Click "Developer" in the main menu and choose "Insert" in the "Controls" sub-menu. Select one of the available controls and specify a location in the spreadsheet. "Assign Macro" screen will open. Select a macro from the available list and click "OK" to complete the process.

Tips and warnings

  • Crystal Ball must be running and referenced in the VBA program for calling Crystal Ball functions from VBA.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.