If installed Connect Edition and my Listview in my vba apps doesn't exist anymore

If installed Connect Edition and my Listview in my vba apps doesn't exist anymore.

I have tried numerous MSCOMCTL.ocx files and no luck.

How do I get the Listviews to work in Connect Edition 13?

We are running the 64 bit version of Connect Edition.

  • Hi,

    MicroStation CONNECT Edition is 64bit application, so libraries referenced by VBA macros have to be 64bit also.

    mscomctl.ocx is Microsoft library, not Bentley, so it's the question for Microsoft. I found an information that 64bit version of mscomctl.ocx was added to update 1707 of Office 365 Pro Plus (of course when 64bit Office is installed).

    With regards,

      Jan

  • I installed Connect Edition and my ListView...

    It's the same for everyone using 64-bit VBA: see this post about Excel VBA, for example.

    Post questions about MicroStation VBA to the Programming Forum.

     
    Regards, Jon Summers
    LA Solutions

  • Hi, Civerson

    Just wondering if you could finally solve what you were asking about last year.

    We are in the same situation right now with CONNECT Edition update 14.

    It'd be great if you could help us. 

    Thanks in advance, 

    Patricia

  • Just wondering if you could finally solve what you were asking about last year

    It's not a problem with MicroStation VBA that Bentley Systems can resolve.  The ListView OCX is not delivered with VBA.  If you're using it, then you've added a reference to an OCX installed on your computer.  Probably, it was installed by another app. such as Microsoft Office.

    The ListView control that you have used for 32-bit VBA is provided by Microsoft. 

    Read Jan's reply and follow his link to Office 365.

     
    Regards, Jon Summers
    LA Solutions

  • I used the ListBox in OpenCities Update 6.

    Use a narrow listbox for the header.

    Use a regular size listbox for the data.

    Here is some code if it helps

    subDisplayCurrentObstacleRecordBox(lTotalRec As Long, lCurrRec As Long, realCnt As Long, _
                                    Optional oListBox As ListBox) ', Optional oListItem As ListItem)
        Const STRFORMAT As String = "         "
       
        Dim i As Integer, findRec As Integer
        Dim maxstrlngth As Integer
        Dim actualCnt As Long
        Dim sCurrStat As String
        Dim name As String * 24
        Dim maxstr As String
        Dim sName As String, sAdd As String
       ' Dim oListItems As ListItems
       ' Dim oListItem As ListItem
       
    '    Set oListItems = oListview.ListItems
       
      'on error GoTo DCRErr

      ' SetHourGlass
    '    Set oListItems = oListview.ListItems
       
        sCurrStat = "Row "
    '    lst.Clear
    ' CKI 10/16/2019 Changed from ListView to ListBox
      '  frmFeatRevw.lstViewPrimaryElem.ListItems.Clear
        frmFeatRevw.lstBoxPrimaryElem.Clear
        If obstacleRecord.BOF = True Then
            sCurrStat = sCurrStat & "(BOF) of " & lTotalRec
        ElseIf obstacleRecord.EOF = True Then
            sCurrStat = sCurrStat & "(EOF) of " & lTotalRec
        ElseIf realCnt = 0 Then
            sCurrStat = sCurrStat & "(EOF) of 0"
        Else
            sCurrStat = sCurrStat & lCurrRec + 1 & " of " & realCnt
         
            findRec = 0
           
            ' loop to find the record that bSelections set to true to display
            ' exit the for loop when the record is found.
            For actualCnt = 0 To lTotalRec - 1
                If bSelections(actualCnt) Then
                    findRec = findRec + 1
                End If
               
                If findRec = lCurrRec + 1 Then
                    Exit For
                End If
            Next
         
            obstacleRecord.MoveFirst
            obstacleRecord.Move actualCnt
            maxstrlngth = 0
           
            For i = 0 To obstacleRecord.Fields.count - 1
                sName = obstacleRecord(i).name
                If Len(sName) < 22 Then
                    sAdd = String(22 - Len(sName), " ")
                    sName = sName & sAdd
                End If
                   
                If obstacleRecord(i) <> vbNull Then
             '       lst.AddItem UCase(sName + strFormat + obstacleRecord(i))
                   ' Set oListItem = oListItems.Add(, , UCase(sName))
                   
                   ' + strFormat + obstacleRecord(i)))
                   ' CKI 10/16/2019 Changed from ListView to ListBox
                 '   Set oListItem = frmFeatRevw.lstViewPrimaryElem.ListItems.Add(, , (UCase(Trim(sName))))
                 '   frmFeatRevw.lstViewPrimaryElem.ListItems(i + 1).SubItems(1) = obstacleRecord(i)

                    frmFeatRevw.lstBoxPrimaryElem.AddItem
                    frmFeatRevw.lstBoxPrimaryElem.Column(0, frmFeatRevw.lstBoxPrimaryElem.ListCount - 1) = UCase(Trim(sName))
                    frmFeatRevw.lstBoxPrimaryElem.Column(1, frmFeatRevw.lstBoxPrimaryElem.ListCount - 1) = obstacleRecord(i)

                Else
             '       lst.AddItem UCase(sName + strFormat + "")
             '       oListview.ListItems.Add UCase(sName + strFormat + "")
                   
                    ' CKI 10/16/2019 Changed from ListView to ListBox
                  '  Set oListItem = frmFeatRevw.lstViewPrimaryElem.ListItems.Add(, , UCase(Trim(sName)))
                  '  frmFeatRevw.lstViewPrimaryElem.ListItems(i + 1).SubItems(1) = ""
                   
                    frmFeatRevw.lstBoxPrimaryElem.AddItem
                    frmFeatRevw.lstBoxPrimaryElem.Column(0, frmFeatRevw.lstBoxPrimaryElem.ListCount - 1) = UCase(Trim(sName))
                    frmFeatRevw.lstBoxPrimaryElem.Column(1, frmFeatRevw.lstBoxPrimaryElem.ListCount - 1) = ""
                End If
            Next
           
            ' if block to set the dismantled check box for records with
            ' obs_acode = "D"... Only works for obstacles  07 15 98
            With frmMainProd
                If StrComp(.lstFeat.List(.lstFeat.ListIndex), "ORS OBSTACLE", 1) = 0 _
                        And .lstDocsofProd.List(.lstDocsofProd.ListIndex) <> "RECTANGULAR ALBUQURQUE SECTIONAL" Then
                    If obstacleRecord!OBS_ACODE = "D" Then
                        frmFeatRevw.chkDismantled.enabled = True
                        frmFeatRevw.chkDismantled.Value = 1
                    Else
                        frmFeatRevw.chkDismantled.enabled = False
                        frmFeatRevw.chkDismantled.Value = 0
                    End If
                End If
            End With
           
            ' Compare width of longest string displayed in list
            ' box to width of list box.  If width of longest string >
            ' width of list box, display a horizontal scroll bar for
            ' the list box.  02/12/98 gba
            ' SetHScroll frmFeatRevw, lst, maxstr
        End If

        frmFeatRevw.lblStatus.Caption = sCurrStat

        'Screen.MousePointer = vbDefault
        Exit Sub

    DCRErr:
        ShowError
        Resume Next    'so we can try and display as much data as possible
        Exit Sub
    End Sub

  • Hello, thank you so much for your answer!

    We'd like to know which version of the file MSCOMCTL.OCX you used. Can you share this, please?

  • I used the ListBox
    which version of the file MSCOMCTL.OCX

    What exactly do you want?

    • The ListBox control is part of Microsoft VBA.  It is available in both 32-bit VBA and 64-bit VBA.
    • The ListView control is not part of Microsoft VBA.   It is delivered in an OCX by other Microsoft product installations.

    There's another list viewer named ListCtrl.  AFAIK that's also a 32-bit OCX with no 64-bit version.

    According to the link provided by Jan, Office 365 and Office 2019 may provide a 64-bit version of MsComctl.ocx.  You'll to talk with your IT support to find if (a) they will upgrade Office to 2019 and (b) whether they will install the 64-bit version of Office.

     
    Regards, Jon Summers
    LA Solutions

  • Hi, all

    We are using MsComctl.ocx 64 bits and in VBA editor of excel I can see listview's control but not in MicroStation's VBA editor. Following you can see a screenshot. 

    Here is screenshot that shows MsComctl.ocx is 64 bits

  • We are using MsComctl.ocx 64 bits and in VBA editor of excel

    In the Excel VBE Editor (IDE) in Excel, do you see MsComCtl.ocx in the Tools|References dialog? 

    Can you see the same in the MicroStation IDE?  No? You must add a reference to MsComCtl.ocx in that dialog.

     
    Regards, Jon Summers
    LA Solutions

  • Hi, Joan

    Yes, we have referenced it but it still doesn't work

    Thanks!