Help with writing a macro or a MVB, please.

Good Morning Folks,

I would like to create what I think is a pretty simple custom command that simply combines the "Measure Area" command and takes that result and then puts it into the the dialog box of the "Place Text" command; thus allowing me to rotate, change font, and all the other things that are found on the the text editor dialog box.  But this is all new to me.  I have started a introductory online course on programming but when I try to relate what I have learned so far to MicroStation v8i Visual Basic it is just "too big" of a jump for me, but the concept of what I am looking for seems so simple.  Could someone please give me some guidance?

In my office we are still using MicroStation v8i SS2.

Any help would be Greatly Appreciated, Wil

  • If you search around there is a MA that has been around for 3 forever's named "aTool.ma" I have a mvba that places area text in the center of the selected element if you would like a starting point. Let me know.  

  • MicroStation's VBA implementation  offers a Macro Record tool, which can generate some useful code as a good starting point. There is a MicroStation VBA book that is very good, too. The key to using the "recorded" code is to replace the code that uses the fixed coordinates and fixed text strings with code that prompts the user to pick elements and/or points and extract the necessary values to be passed along to the "recorded" code. I believe the book has example of that, but even the MicroStationVBA.chm file in the Overview > Getting Started with Visual Basic > Recording and Revising Macros topic is a pretty good explanation of a recorded macro and the edits required to get user input.

    That example is to create a smart line. The code to alow users to select elements is more complex and can be very complex, depending upon the code used. Many examples that manipulate or query elements use classes. While these are nor rocket science, they are a more advanced form of programming. 

    Last word, I recommend this link LA Solutions MicroStation VBA Topics

    It's author, Jon Summers is a fount of knowledge on all things programming. 


    Charles (Chuck) Rheault
    CADD Manager

    MDOT State Highway Administration

    • MicroStation user since IGDS, InRoads user since TDP.
    • AutoCAD, Land Desktop and Civil 3D, off and on since 1996
  • Morning Bob,

    Thanks for your reply, and like you suggested I did some searches for "aTool.ma" and from that downloaded a couple of custom commands that may work.  If they don't workout I may take you up on your custom code.

    Thanks Again, 

  • Good Morning Chuck,

    Thanks for your reply.  I would like to take a class on MicroStation VB through EnvisionCAD but I don't know if my office will spring for it or not, and I need to check to see if there is any online training provided by Bentley on this topic.  Chuck, what is the title of the MicroStation VB that you recommended?

    Just one more question, what is the difference between MicroStation Visual Basic and that "Recording of Commands" procedure that MicroStation has; is that just a simplified interface that produces a mvba file or does it create another type of file entirely? 

    Thanks Again Chuck, and have a Good  Day, 

  • There is also a very good book out there, Learning MicroStation VBA by Jerry Winters that has helped many of us.