There are often requirements that in drawings, certain information should be able to be transferred to other systems.You may find a number of example call as the readouts of geometric data, texts, technical data, and other non-graphical information being transferred into plain text files or in Microsoft Office formats such as Excel spreadsheets.
Possible approaches to using a few examples are presented here, and the example can be understood without prior programming knowledge and are consciously addressed to users who want to make a new one with this topic.
VBA is integrated into MicroStation V8 and can be accessed through Utilities > Macro > Project Manager as shown below:
There are also icons to create new VBA projects, load projects, execute, and record VBA routines within a project. All currently loaded VBA projects are listed in the lower section of the dialog window. VBA programs (.mvba files) can be divided up into separate modules. Modules comprise the routines which are executed.
By default, there is one project file (default.mvba). We will open this file by selecting it and clicking on the VBA Editor icon as shown below:
The VBA editor opens with various windows. If not all windows shown below are opened, double-clicking on the "Module 1" will open the editing area.
In the marked "program text" input field, we can now input the source code of our programs with larger scopes, which can also be divided into multiple modules or projects later on.Before we tackle more complex examples, we will create the typical "Hello World" test to check if the VBA is working properly.For this, we will use the following simple program:
MsgBox "Hello World"
After entering this, you can run the program by hitting the "Run Macro" button circled below. To run your newly created program, it is important to make sure the cursor is in the text of your program before hitting the "Run Macro" button.
If completed correctly, a dialog box will appear, which can be exited by clicking "OK".
If this dialog box appears, we have a fully functioning VBA environment and can move on to the first Specific Example.If, however, and error message did not appear, your VBA installation could be broken. In this case, reinstall the VBA components. If this doesn't work, reinstalling the Prerequisite Pack (from V8 XM) should be reinstalled. In most cases, this will fix the problem. If you are still experiencing errors, please contact Technical Support.
>> CONTINUE ON TO PART 2 >>