How to use the VBA Objects
Call CST STUDIO SUITE from within an external application
The following example code can be entered in the VBA interpreter of an external application like spread sheet or word processor. It creates a CST STUDIO SUITE application object, opens a project and creates a brick:
Sub Main()
Dim studio As Object
'Starts CST MICROWAVE STUDIO
Set studio = CreateObject("CSTStudio.Application")
Dim proj As Object
Set proj = studio.NewMWS
Dim brick As Object
Set brick = proj.brick
brick.Reset
brick.Name "BrickOne"
brick.Xrange "0", "1"
brick.Yrange "0", "2"
brick.Zrange "0", "4"
brick.Create
proj.SaveAs "C:\temp\test.cst", False
proj.Quit
Set studio = Nothing
End Sub
Open a project within the built-in VBA interpreter
This example opens a project from the VBA interpreter of CST MICROWAVE STUDIO:
OpenFile("c:\Examples\thebrick.cst")
With Brick
.Reset
.Name "BrickOne"
.Layer "default"
.Xrange "0", "1"
.Yrange "0", "2"
.Zrange "0", "4"
.Create
End With