TransientElement Error

could any one can help me with below error in VBA?

code:

Sub ShowTransientElementsold()
    Dim tec1 As TransientElementContainer
    Dim ele1 As Element
    Dim flags As MsdTransientFlags
    Dim eleEnum As ElementEnumerator
    Set eleEnum = ActiveModelReference.GraphicalElementCache.Scan
    Set tec1 = CreateTransientElementContainer1(Nothing, flags, msdView1 + msdView4, msdDrawingModeHilite)
   
    Do While eleEnum.MoveNext
    Set ele1 = eleEnum.Current
    tec1.AppendCopyOfElement ele1
    Loop
 
End Sub

 

error image :

 

 

i'm using V8i select series 2

 

regards,

vinoth

 

regards,

vinoth

Parents
  • I don't know what's going on.  I copied your code into a MicroStation V8i SS3 VBA project.  It compiled without error.

    Have you written other VBA code for MicroStation?  Do your other projects compile and run without error?

     
    Regards, Jon Summers
    LA Solutions

  • i missed to attach few of the screen shorts to describe clearly.

    TransientElementContainer not displaying in object browser:

     

    references addequipmentattribute image:

    and "TransientElementContainert"  is missing in declaration list:

     

    regards,

    Vinoth

     

     

    Vinoth Joseph

    ATKINS

    Bangalore, India

  • I think you are not working in Select Series. In your references, 'Bentley Microstation DGN 8.0 Object Library' is for V8.05*

    For select series, it should 8.9 Object Library.

    Sivag

  • TranslientElementContainer class was introduced in MicroStation 08.09.02

    You may want to implement VBA class as follows:

    Private Declare Sub mdlTransient_free Lib "stdmdlbltin.dll" _
      (ByRef freeTedPP As LongByVal eraseDisplay As Long)

    Private Declare Function mdlTransient_addElemDescr Lib "stdmdlbltin.dll" _
      (ByVal tedP As LongByVal edP As LongByVal snappable As Long, _
      ByVal viewMask As LongByVal displayMode As Long, _
      ByVal displayFirst As LongByVal atHead As Long, _
      ByVal initialDisplay As LongAs Long
      
    Dim tedP As Long

    Private Sub Class_Initialize()
      tedP = 0
    End Sub

    Private Sub Class_Terminate()
      Reset
    End Sub

    Public Property Get MdlTransientDescrP() As Long
      MdlTransientDescrP = tedP
    End Property

    Public Function AppendCopyOfElement( _
      elem As Element, _
      Optional drawNow As Boolean = True, _
      Optional snappable As Boolean = True, _
      Optional views As MsdViews = msdViewAll, _
      Optional drawMode As MsdDrawingMode = msdDrawingModeNormal, _
      Optional displayFirst As Boolean = True, _
      Optional atHead As Boolean = True _
      )
        tedP = mdlTransient_addElemDescr(tedP, elem.MdlElementDescrP, _
        IIf(snappable, 10), views, drawMode, IIf(displayFirst, 10), _
        IIf(atHead, 10), IIf(drawNow, 10))
    End Function

    Public Sub Reset()
      If tedP <> 0 Then mdlTransient_free tedP, 1
      tedP = 0
    End Sub
  • Unknown said:
    TransientElementContainer not displaying in object browser

    Here's what you should be seeing — the Bentley MicroStation DGN 8.9 Object library

    I don't know what Bentley vbprct0 type library is, but it is not VBA.

    As others have indicated, you're using the V8.5 version of VBA with MicroStation SS2.  At some point someone must have installed the earlier version of MicroStation after SS2.  The solution is to reinstall SS2, which will add the necessary data to the Windows Registry.

     
    Regards, Jon Summers
    LA Solutions

  • Thanks Jon.

    In "About microstation" dialogue box, it is indicating select series 2 version 08.11.07.443.

    as you suggested, let me reinstall, then i will update you.

    regards,

    vinoth

     

    Vinoth Joseph

    ATKINS

    Bangalore, India

  • Unknown said:
    In "About microstation" dialogue box, it is indicating select series 2 version 08.11.07.443

    If MicroStation V8.5 was installed or re-installed, for whatever reason, after MicroStation V8i then the VBA libraries, which are Windows COM DLLs, will be recorded in the Windows Registry.  It's the MicroStation GUID that is important: the GUID is the same for all editions, so it's the most recent installation that gets Windows' attention.

    MicroStation is a Windows application, so when it asks Windows for the VBA DLLs that correspond to its GUID then it gets whatever Windows thinks is the current DLL.

     
    Regards, Jon Summers
    LA Solutions

Reply
  • Unknown said:
    In "About microstation" dialogue box, it is indicating select series 2 version 08.11.07.443

    If MicroStation V8.5 was installed or re-installed, for whatever reason, after MicroStation V8i then the VBA libraries, which are Windows COM DLLs, will be recorded in the Windows Registry.  It's the MicroStation GUID that is important: the GUID is the same for all editions, so it's the most recent installation that gets Windows' attention.

    MicroStation is a Windows application, so when it asks Windows for the VBA DLLs that correspond to its GUID then it gets whatever Windows thinks is the current DLL.

     
    Regards, Jon Summers
    LA Solutions

Children
No Data