
s2) and select the option Show Data > Quick Watch > Add to Watch ( Ctrl+F9) from the context menu (opened by pressing the right mouse button). You may also double-click on the variable (e.g. A tooltip will then appear informing you of the variables content. Once the execution is paused, you can check the current values of a variable by moving the mouse-pointer over the variable of interest. The execution should then pause automatically at the breakpoint. Start the macro execution again by selecting (F5). Breakpoints are visualized by highlighting the corresponding line and showing a red dot at the beginning of the line. You can now set a breakpoint at the line s2 = s2 & s1 by placing the cursor somewhere in this line and selecting the icon (F9). Pressing the F1 key will then automatically invoke the online help system showing some detailed information about the particular keyword if available. Place the cursor over a keyword for which you want to see an explanation. The program should display a message box containing a single line of text: Hello Hello Hello Hello." Start by selecting the corresponding button: (F5). You should now enter this simple example into the VBA development environment while familiarizing yourself with the editors functions. ' This is a comment (displayed in green color)įunction MultiStr (s1 As String, n As Integer) As String The following example illustrates how other functions can be used from within this main routine: Each VBA program must have at least a subroutine Sub Main which will automatically be called when the program is started. Subroutines and FunctionsĪ VBA-script can be regarded as a collection of subroutines and functions. The online documentation contains more detailed information on these topics as well. The following subsections provide a basic overview of typically used VBA language elements and should help you get started with this programming language. The following shortcuts are available within the VBA editor or debugger: If no keyword can be found, a general help page will appear allowing you to navigate through the help system. Pressing the F1-key in the editor window provides some context-specific help on the keyword positioned at the mouse cursors location. Finally, the third section contains examples that may be used right away or give you some ideas for developing your own macros. A second part contains specific information on the collection of CST Studio Suite objects and a detailed explanation of their methods.

The first section provides reference information on the basic VBA language elements. The contents of this help system are divided into three different sections. You can easily access the VBA online help system from CST Studio Suite by selecting Help > Help Contents from the main window. In addition to the Ribbon tab, the editor also features a context menu (opened by pressing the right mouse button) which contains more tools such as find, replace, etc. The development environment consists of a Ribbon tab and an editor window as shown below: You can open the VBA development environment by choosing Home: Macros > Macros > Open VBA Macro Editor. Each part of the program can be controlled by special VBA objects: A VBA Application Object can be used to control the program. The syntax of the BASIC interpreter is explained in the WinWrap Basic Language Reference.ĬST Studio Suite is implemented as an OLE automation server. We strongly recommend you work through this introduction, which should only take a few hours, to obtain a good working knowledge of macro programming in general. The explanations are supported by a variety of examples which should assist you in building your own macros. The following sections start by providing general information on the VBA-based macro language before the actual integration into CST Studio Suite is discussed. Mathematical Functions, Operators and ConstantsĬoncepts of Macro Programming in CST Studio Suite Variables, Data Types and Type Conversions

It can also be opened by selecting Home: Macros > Open VBA Macro Editor. The editor opens automatically if a macro is edited or created.
#Visual basic for applications language reference windows#
Microsoft Office ®, MATLAB ®, AutoCAD ®, MathCAD ®, Windows Scripting Host, etc.).

An interface to OLE automation enables a seamless integration into the Windows environment (e.g. The powerful VBA (Visual Basic for Applications) compatible macro language is equipped with a fully featured development environment including an editor and a debugger. A powerful environment can be used for automating any task within its modules or even in combination with external programs. This language may be used either for creating own structure libraries or for the automation of common tasks. The language of the built in BASIC interpreter is almost 100% compatible with the Visual Basic for Application language. VBA Overview VBA Overview The CST Studio Suite tools can be controlled from a Visual Basic (VBA) script.
