MicroStation® is a 3D computer-aided-design (CAD) application for personal computers and workstations. MicroStation is produced by Bentley Systems, Inc.
MicroStation can be customised in various ways. This article shows how to generate a text grid with MicroStation Visual Basic for Applications (MVBA).
Questions similar to these, posed by MDL and VBA developers, appear on the Bentley Discussion Groups, typically the MicroStation Programming Forum.
Q How can I generate a text grid with MicroStation VBA?
Q I need a replacement for obsolete MDL app incarray?
The questionner is seeking an app to generate a grid of numbers, like this …
A The project is straightforward to implement using VBA. When you load and run the macro it pops this dialog …
Use the widgets in the dialog to specify …
![]() | ![]() |
Column Major | Row Major |
Click the Pick Text button to choose a numeric text element. By that we mean an existing DGN text element visible in your DGN model. The macro uses that text element as the starting point (origin) of the grid. It uses the value displayed in that text as the initial value of the grid text. It uses the text element as a template when creating each new member of the grid, so that all text looks similar.
Once you've accepted a text element, the grid is generated automatically. If you want to adjust the settings in the dialog and recreate the grid, use MicroStation's Edit|Undo menu to delete the grid you just created.
When the text elements are created, they are added to a MicroStation Named Group...
The Named Group may help when subsequently you want to manipulate all the text elements at once.
You can download the example VBA Text Grid Generator project. The macro should run in both MicroStation CONNECT and MicroStation V8i.
Copy the .mvba
file to a known good location where MicroStation looks for VBA macros.
For example, ..\Organization\Standards\Macros
or any folder that configuration variable
MS_VBASEARCHDIRECTORIES
includes.
Open the project in the VBA editor.
Read the notes in module modMain
.
That module also contains the keyin to run the example …
vba run [TextGridGenerator]modMain.Main
Post questions about VBA to the MicroStation Programming Forum.