Listview.listitem.key Intermitent Failure RRS feed

  • Question

  • I have a program that uses Listview regularly in numerous forms.  The program is deployed globally.  The program design routinely makes use of the listitem.key to locate and track various listitems as necessary for the program to work.  Recently came across an issue where the listitem.key doesn't work, but only on one form and only on a handful of computers.  The structure and design of the program where the listitem.key is used is the same throughout.  Here are the particulars:

    1. The program and forms exist in an addin
    2. All the forms use the listview construct and make use of the key property
    3. There are no issues on any of the other forms but the one and only on a handful of computers 
    4. The failure causes a generic Automation Error notice
    5. I'm using late binding in all cases.
    6. In the form in question, the listview is created properly and can be seen and accessed
    7. The failure comes at the time of adding listitems to the listview from a listobject in a table in the main workbook
    8. The listitem will add properly without the key and subitems can be accessed and modified.
    9. The only thing that fails is the .key property.  
    10. I've modified the code to add the key property at the end after successfully loading the listitem and each subitem, but to no effect.
    11. The key value being added is a string in the form of "R1"

    Here's the code that is failing:

    Set oLVRIPlan = Me.Controls.Add("MSComctlLib.ListViewCtrl.2", "lvContingencyPlan", True)

    For Each lrRow In loTemp.ListRows
        With lrRow
            Set lstItem = oLVRIPlan.ListItems.Add(Key:=.Range(1, 1), Text:=.Range(1, 1))
            lstItem.SubItems(1) = .Range(1, 2)
            lstItem.SubItems(2) = .Range(1, 3)
            lstItem.SubItems(3) = .Range(1, 4)
        End With
    Next lrRow

    Any ideas?

    • Edited by TSWEIR Wednesday, August 13, 2014 12:53 PM
    Wednesday, August 13, 2014 11:40 AM