Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
  • Welcome
  • Products
  • Support
  • About
  • More
  • Cancel
MicroStation
  • Product Communities
  • More
MicroStation
MicroStation Wiki MicroStation VBA Resources Revisited [CS]
    • Sign in

    • +MicroStation Wiki
    • +Administration Wiki
    • +Annotations Wiki
    • +Bentley View Wiki
    • +MicroStation PowerDraft
    • -Programming Wiki
      • A class to help create and modify text element
      • A Complete Example
      • A MicroStation VBA Example With Bentley ProjectWise
      • AddIn Development Using VB.NET
      • C# .NET Template with IPrimitiveCommandEvents Class
      • Capturing Graphics in Dynamic Views
      • Compiling MDL Applications
      • Database Manipulation
      • Debugging Native Code MDL Applications
      • Developing Code in VBA
      • Developing MicroStation Applications For DWG Files
      • Drag and Drop in MicroStation
      • Error: "Cannot save changes to VBA project 'Support' because it is read-only"
      • Getting And Setting Elements Using Graphic Groups In VBA [CS]
      • Getting Started with Visual Basic
      • How To Write A Recursive Routine In MicroStation VBA [CS]
      • Introducing Segment3D Methods In MicroStation V8 2004 Edition
      • Known issues in MDL and MicroStationAPI
      • Launching VBA Applications As Initapps Or Dgnapps [CS]
      • Learning MicroStation Addins Step by Step
      • MDL - Getting Started With XAttributes In MicroStation V8 XM Edition
      • MDL - Native Code Application Development
      • MDL Or MicroStation BASIC Choosing The Right Tool [TN]
      • MFC Dialog And Native Window Support
      • Microsoft Office VBA Patch Utility
      • MicroStation BASIC FAQ
      • MicroStation BASIC Limits [FAQ]
      • MicroStation Developer Documentation and Example Code
      • MicroStation Programming Advice
      • MicroStation SDK
      • MicroStation V8 Programming Tools Readme
      • MicroStation V8 VBA Programming Resources [CS]
      • MicroStation V8 XM Edition View Code Updates
      • MicroStation VBA Resources Revisited [CS]
      • Migrating Dimension Code To MicroStation V8
      • Migrating MDL Applications To Native Code
      • Mouse Wheel Events And The Visual Basic 6.0 IDE
      • Porting MDL Applications To MicroStation V8
      • Reading Elements From A Microsoft Access Database With VBA [CS]
      • Running MDL Applications
      • Scanning For MicroStation V8 Elements In VBA [CS]
      • Unleash A Workspace Wizard Automating Workspace Creation With MicroStation V8 And VBA [CS]
      • Using VBA To Detect The Current Or Last Used Command
      • Using VBA To Programmatically Export A VBA Project [CS]
      • Using VBA To Programmatically Import A VBA Projects Components And References [CS]
      • VBA -- Creating A Complex Application
      • VBA Interface Error: failed creating the comp manager - 0x80040583
      • VBA interface error: unable to get IDE
      • vba recording
      • Working With Levels In MicroStation VBA [CS]
      • Writing An MDL Application To Output Custom Placemarks To Google Earth
      • [V8i C++] PointCloud IPointCloudChannelDisplayHandler
    • +Visualization Wiki

     
     Questions about this article, topic, or product? Click here. 

    MicroStation VBA Resources Revisited [CS]

     

    This Client Server article is republished in its entirety from 2004 for reference purposes. It was written for MicroStation v08.05.00.64 and may not apply to any other version.  

    By Bentley Technical Support Group
    15 November 2004

    This article is an update to an earlier article by Michael Dougherty, which includes a number of new MicroStation V8 VBA resources. There are now a number of new resources available to assist in the use of the MicroStation VBA object library.

    Resources delivered with MicroStation V8 and MicroStation V8 2004 Edition

    • MicroStation V8 Visual Basic for Applications Help file
      This help file is arguably the best resource for MicroStation VBA because it contains a description of all VBA objects, events, methods, properties, types, VBA code examples, and other miscellaneous information.

      You can open the help file by either clicking Start->Programs->MicroStation->Documentation-> MicroStation VBA or browsing Windows Explorer: ...\Program\MicroStation\MicroStationVBA.chm.

      When you are using a particular object, event, method, property, or type in your VB code, you can find information about it quickly by simply placing the cursor on the code and pushing the F1 key. This is one of the most useful features of the VBA Help file.


      Figure 1.
    • VBA Object Browser
      This is a feature in the VBA interface. It lists the object libraries, the type libraries, classes, methods, properties, events, and constants you can use in code, as well as the modules and procedures you defined for your project.

      There are three ways to open the Object Browser from within the VBA interface:

      Click View->Object Browser
      Push the F2 key
      Click the Object Browser button on the Standard toolbar

      The Object Browser can be used to search your object library or any object library currently referenced to the active project. This can be especially useful if you were using multiple applications within your project, such as MicroStation and Excel.

      The VBA help file can be utilized in the same way as mentioned above. If you highlight a particular object, event, method, property or type, you can find information on it quickly by pushing the F1 key.

      Figure 2.

      The VBA help file can be utilized in the same way as mentioned above. If you highlight a particular object, event, method, property or type, you can find information on it quickly by pushing the F1 key.

    Examples delivered with MicroStation V8 and MicroStation V8 2004 Edition

    A few examples are delivered with MicroStation V8 and 2004 Edition. They are located in the ...\Workspace\System\vba\examples folder. This list describes some of those examples included with MicroStation V8 2004 Edition 08.05.00.64:

    • CopyElementExample.mvba: How to copy an element using dynamics.
    • DataBaseExamples.mvba: How to interact with a database.
    • dbcheck.mvba: This database example shows you how to change all the linkages from the Database Type ODBC to OLEDB.
    • ElementPlacementExample.mvba: How to create/place a block, ellipse, arc, circle, curve, grid and line using dynamics.
    • LineStylePicker.mvba: How to create a line style picker using a VBA ListBox item.
    • MbeExample.mvba: This example shows you how to access the old MicroStation object model that MicroStation Basic uses (This logic is not recommended for new macros).
    • Mdl2Vba.mvba: This example illustrates how to convert a MicroStation Basic macro to a VBA macro.
    • MdlExamples.mvba: This example shows how to use MDL functions in VBA.
    • PictureExample.mvba: This example shows how to display graphical elements on a form.
    • ReadElementExample.mvba: This example shows how to scan a model for specific element types.
    • SCByLevel.mvba: This example shows how to create a plugin for the Standards Checker. It will scan for ByLevel properties.
    • SCSimpleRefCheck.mvba: This example shows how to create a plugin for the Standards Checker. The example finds reference file attachments that specify a design file that cannot be loaded.
    • SCCompleteRefCheck.mvba: This example is the same as the above except it also shows how to use the Standards Checker's error reporting and logging mechanisms.
    • TextExamples.mvba: This example shows how to manipulate text element's scale and angle. It also shows how to change the text's case (upper and lower).
    • VBE_Tools.mvba: This example shows how to use the root object that contains all other objects and collections represented in Visual Basic for Applications.

    Resources from Bentley


    Figure 3.

    Bentley Developer Support

    The Bentley Developer Support Group assists users with programming issues and questions. The programming languages currently supported are MDL, VBA, JMDL, and MicroStation Basic.

    Bentley Developer Support is a great resource if you are having a logic problem or if you are trying to use an object that is not working as you expected. You can find examples created by the Developer Support group on MicroStation on the Web. They are located in a downloadable zip file called VBA General (V8VBAExamples.zip) located on the site's utilities page. It is accessible only to users who have a valid login and password. Scroll to the bottom of the page and you will see information about accessing these examples (Figure 4).


    Figure 4.

    The VBA General zip file contains various VBA examples that can do a multitude of things. These examples are updated regularly. When you download the V8VBAExamples.zip you will notice that there are no compiled *.mvba files, only the source *.bas, *.frm and .cls files. After the zip file is downloaded you will need to unzip it into a folder so that the sub folders for each example are also created, create the VBA Project (*.mvba) for the example you want to use, then import the source files into it.

    There are a number of useful utilities on this Web page in addition to the VBA examples. It would be a good idea to download those utilities that may improve your workflow.

    Some methods for opening this Web page:

    Enter: http://microstation.bentley.com/resources/utilities.cfm into your favorite Web browser.

    • Click Help->MicroStation on the Web.
    • Click the Go on the Web button.
    • Click the Download link, which is located at the top right corner of the Web page.
    • Specify your login and password, if needed.
    • Click the Utilities link, which is located at the left of the Web page under the title Download.
    • Scroll to the bottom of the Web page.

    Bentley VBA Discussion Group

    Bentley discussion groups are very good resources for users of MicroStation/J and higher versions. They allow you to meet other users of Bentley products, exchange ideas, and discuss a wide range of technical subjects. They can be accessed via most common discussion group newsreaders or Web browsers and are a good source of how-to tips, technical information, and programming techniques from Bentley employees and professionals who use our products.

    For more information on the Bentley discussion groups, open the MicroStation Help file and search for discussion groups, or go to: http://selectservices.bentley.com/discussion/index.htm.

    Why should you join the ‘Bentley.microstation.v8.vba' discussion group?

    Many users and Bentley developers monitor this discussion group. You may be able to get a quick answer to a question or a recommendation on how to approach a specific issue.
    Your question about VBA may have been answered already. If another user has had the same issue, a solution or work-around may be posted.
    You can browse through all the issues and gather any source code or information that may be useful in the future. Occasionally, I browse through postings looking for a solution or work-around that may be useful for future projects.

    Client Server

    Client Server includes many articles on various VBA topics. It is recommended that you search this Web page regularlybecause Bentley will keep adding more articles.

    Bentley Institute

    The Bentley Institute does the training for MicroStation and Bentley Software. There are currently two VBA Instructor-led courses available:

    • Getting Started with MicroStation VBA - Become familiar with the MicroStation VBA programming environment and gain a basic understanding of how VBA interacts with MicroStation.

      Who should attend: experienced MicroStation users or CAD managers with some experience writing MicroStation BASIC programs
    •  MicroStation VBA for VB Professionals
      Learn how to work with MicroStation's VBA objects to automate fundamental operations in the product.

      Who should attend: experienced Visual Basic programmers with additional experience in MicroStation

    For more information on Bentley Institute courses, visit http://bentleyinstitute.bentley.com.     

    See Also

    Client Server Archive

    MicroStation Desktop TechNotes and FAQs

    Comments or Corrections?

    Bentley's Technical Support Group requests that you please confine any comments you have on this Wiki entry to this "Comments or Corrections?" section. THANK YOU!

     

    • Archived Client Server
    • client server
    • client server 2004
    • Share
    • History
    • More
    • Cancel
    • Elisa McGraw Created by Elisa McGraw
    • When: Tue, Jul 21 2009 9:25 AM
    • Dan Koval Last revision by Bentley Colleague Dan Koval
    • When: Mon, Aug 26 2013 9:31 AM
    • Revisions: 14
    • Comments: 1
    Recommended
    Related
    Communities
    • Home
    • Getting Started
    • Community Central
    • Products
    • Support
    • Secure File Upload
    • Feedback
    Support and Services
    • Home
    • Product Support
    • Downloads
    • Subscription Services Portal
    Training and Learning
    • Home
    • About Bentley Institute
    • My Learning History
    • Reference Books
    Social Media
    •    LinkedIn
    •    Facebook
    •    Twitter
    •    YouTube
    •    RSS Feed
    •    Email

    © 2022 Bentley Systems, Incorporated  |  Contact Us  |  Privacy |  Terms of Use  |  Cookies