Dear All,
I would like to populate a treeview using Columns from excel sheet. Col A is having parent name, Col B is having child name and Col C is having tool tip for each Child and parent. I am able to import parent and child in treeview but could not manage to import tool tip. I thanks in advance for support.
Code used is:
Private Sub UserForm_Initialize()
'for excel to treeview
TreeView2.LineStyle = tvwRootLines ' showing + sign in treeview
Dim c As Range
Dim nParent As node
Dim nChild As node
'ON error next
On Error Resume Next
'Parents are stored in Col A and child are stored in col B . Tool tip in Col C
'getting parent name from Col A
For Each c In Sheet3.Range("a1:a" & Range("a" & Rows.Count).End(xlUp).Row)
Set nParent = TreeView2.Nodes.Add(, , c.Value, c.Value)
'Ensureing no error is there
If Err.Number <> 0 Then
'Error reset and setting parent
Err.Clear
Set nParent = TreeView2.Nodes(c.Value)
End If
'getting Child name from Col B
Set nChild = TreeView2.Nodes.Add(nParent, tvwChild, , c.Offset(0, 1).Value)
Err.Clear
Next
I would like to populate a treeview using Columns from excel sheet. Col A is having parent name, Col B is having child name and Col C is having tool tip for each Child and parent. I am able to import parent and child in treeview but could not manage to import tool tip. I thanks in advance for support.
Code used is:
Private Sub UserForm_Initialize()
'for excel to treeview
TreeView2.LineStyle = tvwRootLines ' showing + sign in treeview
Dim c As Range
Dim nParent As node
Dim nChild As node
'ON error next
On Error Resume Next
'Parents are stored in Col A and child are stored in col B . Tool tip in Col C
'getting parent name from Col A
For Each c In Sheet3.Range("a1:a" & Range("a" & Rows.Count).End(xlUp).Row)
Set nParent = TreeView2.Nodes.Add(, , c.Value, c.Value)
'Ensureing no error is there
If Err.Number <> 0 Then
'Error reset and setting parent
Err.Clear
Set nParent = TreeView2.Nodes(c.Value)
End If
'getting Child name from Col B
Set nChild = TreeView2.Nodes.Add(nParent, tvwChild, , c.Offset(0, 1).Value)
Err.Clear
Next