For the purpose of this article, we'll assume the attached SVB macro that opens an example dataset in Statistica and plots a simple histogram is the macro we want to make into a Visual Studio Application.Note that depending on the version of Visual Studio used, the menu options and screenshots below may differ slightly.
1. Launch Visual Studio and select "Create a new project" . For older versions of Visual Studio, this may be File >>New Project
2. Select Console App (.NET Framework )
3. Name your project appropriately. For this example, we are naming the project as StatHistogram. Click Create
4. Before adding code from the SVB (Statistica Visual Basic) macro attached to the article, add appropriate Statistica library references. Select Project >> Add References >COM Type Libraries. For this example , we select STATISTICA Graphics Type Library and Statsoft STATISTICA dictionary library and click OK.
5. Type the 2 lines below at the start of the code to import the libraries referenced above:
Imports STATISTICA
Imports STATISTICAGraphics
and add the first 2 lines within the Main module as :
Dim sApp As New Application
sApp.SWSInfo("admin", "[Admin password for Statistica enterprise]")
NOTE : Above SWSInfo needs to be replaced with login information that corresponds to user's Statistica installation.
6. Open the attached Statistica Visual Basic macro and copy the code from the attached macro to the main module :
Revise the line 2
Set ssData = Spreadsheets.Open(Path &"\Examples\DataSets\Characteristics.sta",False) to ssData = sApp.Spreadsheets.Open("C:\Program Files\Statistica\Statisrtica 13\Examples\DataSets\Characteristics.sta", False)
i.e Remove the "Set" and bind the Spreadsheets to the sApp object we created earlier. Note that if the line is Set ssData=ActiveDataSet from a recorded macro,we want to explicitly change it to use Spreadsheets.Open method to refer to the file instead.
Remove all consequent "Set" that is highlighted with a red rigged line :
7. Rewrite all lines highlighted with a red rigged line by adding the appropriate module such as sApp.Analysis. The easiest way maybe to delete the preceding character and add it again for the Intellisense prompt and choose appropriately. In the below example we delete ( and add it again.

Continue doing the same for all the red rigged lines.
8. Once all the rigged lines are corrected, assign the output to a variable and save it some location as shown below . Comment out the line with newAnalysis.Routeoutput since this context works only within Statistica.
Verify that the compiler displays "No issues found"
9. Save the code and then select Build>>Build Solution
10.
After the build succeeds click on the green triangle Start to debug and run the code
11. From the [location that the project was saved in]\bin\Debug, double click on the [Solutionname].exe to run the program and verify that the output graph is generated in the location given in the code.