MicroStation VBA: Item Types

  • Products
  • Services
  • All Publications
  • CONNECT Publications
  • Links
  • WishList
  • LA Solutions
  • Home
LA Solutions
tel: +44 1398 361 800

PropertyHandler

Use a VBA property handler to find information about Item Types.

Sub PropertyList2()
    Dim oElement As Element
    Set oElement = ActiveModelReference.GetElementByID(DLongFromLong(447))
    ProcessElement oElement
End Sub
Private Sub ProcessElement(oElement As Element)
    Dim ph As PropertyHandler
    Set ph = CreatePropertyHandler(oElement)

    Dim accstr() As String
    accstr = ph.GetAccessStrings

    If (True = ph.SelectByAccessString("Room__x0020__Number")) Then
        ph.SetValue "999"
    End If
End Sub

Note:  This works with MicroStation CONNECT Update 2 and later. Earlier versions of MicroStation had a bug that prevented PropertyHandler.SetValue from working with an Item Type.

Get a list of Property Names …

Sub PropertyNameList()
    Dim oElement As Element
    Set oElement = ActiveModelReference.GetElementByID(DLongFromLong(447))

    Dim oPH As PropertyHandler
    Set oPH = CreatePropertyHandler(oElement)
    Dim strs() As String
    strs = oPH.GetAccessStrings
    For i = LBound(strs) To UBound(strs)
        Debug.Print strs(i)
    Next
End Sub

Bentley Technology Partner

Trademarks

All trademarks are acknowledged. Trademarks may be registered in some jurisdictions.
Contact LA Solutions using this enquiry form.


Home
Updated on 04-Aug-2016 Copyright © 2016…2025 Jon Summers