OS.Interpreting OpenSTAAD API Syntax for VBA
The functions documented for the OpenSTAAD are given in the C++ syntax. It’s typically a simple process to interpret these for use in a VBA macro.
Classes and Method
In the C++ syntax used in the documentation, class syntax is listed in the format
OSClassUI::Method
. In VBA, this should
be instead given as
Class.Method
.
In the example, OpenSTAAD was instantiated using the object objOpenSTAAD
. Classes were
then called using the format objOpenSTAAD.Class
(for example, the
Geometry class was referenced using objOpenSTAAD.Geometry
).
The exception of course is the root
OpenSTAAD functions, which will use whatever variable
you have used to instantiate OpenSTAAD (for example,
objOpenSTAAD.GetBaseUnit
). That is, the OpenSTAAD object acts
as the class for these functions.
Return Values
The syntax listed indicates if a function has a return value with a leading VARIANT. This simply means that function will return a value that typically will be stored into a variable. If the function syntax is listed with a leading void, then there is no return value.
Variables and Parameters
The syntax listed typically indicates parameters as type VARIANT FAR, which is not necessarily useful.
Instead, it is important that you read the parameter descriptions which will indicate what type of variable to use (i.e., string, long). This will indicate what type of variable to declare in VBA before you use it.