Written by: STATISTICA 1/26/2010 4:34 PM
This program illustrates various general features of the STATISTICA Visual Basic language. When you run the macro, this simple example program will display the following dialog:
and then one of two message boxes depending on the user's action:
In STATISTICA, from the File menu, select New. In the Create New Document dialog, select the Macro (SVB) Program tab. Enter a name in the Name field, and click the OK button.
Now, copy the following SVB code, and paste it into the macro:
Sub Main ' Bring up a Message Box, with the Ok and Cancel ' and with the following text; ' note the continuation symbol _(underline) at the ' end of the first line, to allow the single statement ' to span two lines If MsgBox ("Hello! Click OK or Cancel", _ vbOkCancel)=vbOK Then
MsgBox "You clicked OK" Else MsgBox "You clicked Cancel"
End If End Sub
To run this program, click the Run button on the toolbar, press F5, or select Run Macro from the Run menu.
This program consists only of the Main routine which is declared as Sub Main at the beginning, and terminated with an End Sub at the end.
As you can see, all lines that start with a single quotation mark are interpreted as comments.
You can break single commands into multiple lines by terminating each line with an underscore ("_"; which must be separated from the preceding text by a blank space).
Note that at any time, to learn more about the different keywords and statements used in this program, you can highlight the respective text, and then press F1 to display the general SVB help text explaining the syntax for the respective keyword or statement and providing simple examples on how to use them.
sb
0 comment(s) so far...