MVBA FAQ


Use this page to see frequently asked questions.
Related Topics:  Best PracticesSyntaxHighlighter TerminologySecure Upload

Getting Started
Productivity

 

To be most productive in MicroStation VBA consider learning a couple keystrokes to help make your learning MicroStation VBA easier.

  1. Open the Microsoft VBA Editor (Alt + F11)
  2. Open the Microsoft VBA Object Browser (F2)
  3. Search in the Object Browser for keywords of interest
  4. Open help for a specific item (Select an item, then press F1)
  5. Search the open help file (Click the Search Tab, then use wildcard and boolean search operators.  e.g. *linear* AND *element* AND *properties*
  6. TIP: Always look to the top of each VBA help page for an "Example" link providing code snips to quickly test functionality.

VBA programs process selected elements using a Model Reference (like separate sheets in a book), so code to process selected elements in the ActiveModelReference would look somewhat like this:

 
Option Explicit

Sub ProcessSelectedElements()

    Dim oModel As ModelReference: Set oModel = ActiveModelReference
    Dim oEE As ElementEnumerator: Set oEE = oModel.GetSelectedElements()
    Dim oEl As Element
    Dim sMessage As String
    Do While oEE.MoveNext
        If sMessage <> "" Then
            sMessage = sMessage & ", " & DLongToString(oEE.Current.ID)
        Else
            sMessage = DLongToString(oEE.Current.ID)
        End If
    Loop

    MsgBox sMessage, vbOKOnly, "Selected Element IDs"

End Sub

 

Projects
Troubleshooting