STAAD.Pro Help

OS. Instantiating the OpenSTAAD Library for Use

The first thing necessary to access STAAD project data from within another application is to instantiate, or create an instance of OpenSTAAD within the other application. In Visual Basic for Applications (VBA), this may be done by creating an object variable and then assigning to it the OpenSTAAD object. The VBA GetObject function may be used for this.

The object which controls the STAAD.Pro environment is referred to as StaadPro.OpenSTAAD. This object must be created in order to get access to any of the internal graphical functions within STAAD.Pro (including the creating of menu items and dialog boxes) as well as access to STAAD’s viewing, geometry modeling, results grid, and post-processing functions. The following VBA function can be used to instantiate or create this object:

Set MyObject = GetObject("filepath", "ojbectclass")


MyObject the Object name declared in a previous Dim statement.
filepath the optional string providing the full file path and name of the file containing objects to retrieve. In the case of OpenSTAAD, this can be omitted, along with the trailing comma.
objectclass the string representing the class of the object. In the case of OpenSTAAD, this is always Staadpro.OpenSTAAD.


Set objName = GetObject("StaadPro.OpenSTAAD")

At the conclusion of your OpenSTAAD application, the OpenSTAAD object(s) should be terminated, to unlock the handles within the application to the OpenSTAAD functions, and to free system resources.


Sub How2Begin()
	'Create a variable to hold your OpenSTAAD object(s).
	Dim objOpenSTAAD As Object
	'Launch OpenSTAAD Object
	Set objOpenSTAAD = GetObject(, "StaadPro.OpenSTAAD")
	'At the end of your application, remember to terminate the OpenSTAAD objects.
	Set objOpenSTAAD = Nothing
End Sub