1

Hi all this is likely a simple syntax error but I am trying to use a variant/string array stored in a scripting dictionary (early binding). I have tried a few methods (moving it to a tmp array using the key and calling the values straight from the dictionary using the key).

The aim is populate a treelist in a form with headers from text files selected by a user. There is no problem assigning the values to the dictionary or using the keys as the parent for the list.

Private Sub UserForm_Activate()
    Dim varKey As Variant
    Dim tmpVals() As Variant
    Dim i As Long
    Dim tmpStr As String

For Each varKey In dictFhdrs.keys()

Debug.Print Len(varKey)
   tmpStr = Right(varKey, Len(varKey) - InStrRev(varKey, "\", -1, vbTextCompare) - 1)
   TreeView1.Nodes.Add Key:=varKey, Text:=tmpStr



   tmpVals = dictFhdrs(varKey) 'error here




    For i = LBound(tmpVals) To UBound(tmpVals)
        TreeView1.Nodes.Add varKey, tvwChild, CStr(varKey & tmpVals(i)), CStr(tmpVals(i))

    Next

Next End Sub

0 Answers0