This tip is simple and very important. Always start writing a Statistica Visual Basic (SVB) macro with Option Explicit.
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.
Recommended Comments
There are no comments to display.