Jump to content
  • Option Explicit with Spotfire Statistica® Visual Basic


    This article explains how to use Option Explicit with Visual Basic in Spotfire Statistica®

    This tip is simple and very important. Always start writing a Statistica Visual Basic (SVB) macro with Option Explicit

    option_explicit_with_svb_0.png.cd5eab4b5e4e9e05b420dc92a97ab837.png
    This statement specifies that variables in a macro must be declared explicitly. If the programmer doesn?t declare the variable in the code before attempting to use it, the macro balks and displays an error message. Aside from the simplest, most basic three-to-five lines of code macro, it just makes sense to use this option. Even Microsoft advises using ?Option Explicit? when writing code. 

    Without Option Explicit, a misspelling results in a brand-new, unexpected variable.  The code can produce all kinds of unanticipated, incorrect results. And in a complex macro this error can be time consuming to locate. 

    The user can add Option Explicit easily when creating a new SVB macro. The check-box for it is easy to see below. You?ll have to check it yourself; the default value is unchecked.

    optionexplicitselectionbox.jpg.338984c2bad809b9c4c5818776d188b3.jpg


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...