2016-06-02 2 views
1

며칠 동안 붙어 있기 때문에 누군가가 나를 도울 수 있기를 바랍니다.엑셀 형식 treeview의 자식 노드는 부모와 동일한 수준이됩니다.

트리보기에서 시각화하려는 워크 시트가 있습니다. 이것이 내 첫 번째 질문이며 내 평판이 충분히 높지 않기 때문에 이미지가 링크로 제공됩니다. img of Worksheet to visualise

'i:loop through objects 
'j:loop through object childs 
'counter: keep track of how many childs processed 

For i = 1 To 5 
Set parentCell = rng.Offset(counter, 0) 'parent values 
strParent = parentCell.Value 'parent values 

' Build the treeview for both the Left and the right side of the screen 
trvLeft.Nodes.Add Key:=strParent, Text:=strParent 
trvRight.Nodes.Add Key:=strParent, Text:=strParent 


For j = 1 To HelperMethods.AmountInEntity 'can be any number 
    strPresent = rng.Offset(counter, 6).Value '"x" or "" 

'Add to left treeview 
    Call trvLeft.Nodes.Add(Relative:=strParent, Relationship:=tvwChild, Key:=rng.Offset(counter, 4).Value, Text:=rng.Offset(counter, 4).Value) 

'add to right treeview. If not present, mark as red. 
    If strPresent = "x" The 
     Call trvRight.Nodes.Add(Relative:=strParent, Relationship:=tvwChild, Key:=rng.Offset(counter, 5).Value, Text:=rng.Offset(counter, 5).Value) 
    Else 
     With trvRight.Nodes.Add(strParent, tvwChild, rng.Offset(counter, 5).Value, rng.Offset(counter, 5).Value) 
       .ForeColor = vbRed 
     End With 
    End If 

    counter = counter + 1 

Next j 
Next i 

뭔가 모든 노드가 같은 수준에 생성 될 때, 그 부모에 노드를 추가하는 잘못.

내가 알아 차린 이상한 점 중 하나는 자녀가 상단에 추가되는 동안 부모가 목록 하단에 추가된다는 것입니다. 사전에 img of flat tree

감사합니다,

필립

답변

0

은 내가 트 리뷰를 제거하고 새로운 것을 만들었습니다. 방법을 묻지 마라.하지만 지금은 효과가있다. 이 더 고립 된 사건이 ​​없었다 그래서 마이크로 소프트 엑셀의 불가사의 ...

-edit-

오류가 다시 발생했습니다. 누구든지이 문제를 일으킬 수있는 아이디어가 있습니까?