Macro (SVB) Programs Example - Accessing Statistica Visual Basic Functions from Microsoft Word

Here is essentially the same program as that shown in Accessing Statistica Visual Basic Functions from Microsoft Excel, demonstrating how Statistica Visual Basic functions can be used from Microsoft Word Visual Basic. As described in the Microsoft Excel example, make sure that the Statistica reference library is loaded; then try the following program.

Sub main()
' Run the Statistica application; create the Statistica
' Application object and assign it to variable (object) x.

Set x = CreateObject("Statistica.Application")

' Create a Statistica Basic Statistics object (i.e., run the
' Basic Statistics module; start it with data file exp
' (note: the actual location of that data file may be
' different on your installation).

Dim s As Statistica.Spreadsheet

Set s = x.Spreadsheets.Open _
Path & "\Examples\DataSets\Exp.sta")

Set a = x.Analysis(scBasicStatistics, s)

' The following 6 lines of code will produce a summary results
' Spreadsheet from the STATISTICA Basic Statistics module.

a.Dialog.Statistics = scBasDescriptives
a.Dialog.Variables = "5-8"
out = a.Dialog.Summary

' Select all rows and columns in the Statistica results Spreadsheet.


' Copy the highlight selection (all rows and columns in the
' Summary results Spreadsheet.


' Paste in the summary statistics (to current selection, cursor

' position).




End Sub

Since the Visual Basic implementation in Microsoft Word is also very complete, and since all functions of Statistica are exposed via Statistica reference libraries, you can see how one can build highly customized "hybrid" programs that combine the power of various programs into virtually new applications.