Option
Explicit
Sub
Bsp()
Dim
objNode
As
MSComctlLib.Node
Dim
objNodeSub
As
MSComctlLib.Node
With
Tabelle1.TreeView1
With
.Nodes
Call
.Clear
Set
objNode = .Add(Text:=
"Test1"
)
Call
.Add(objNode, tvwChild, Text:=
"Test1-1"
)
Call
.Add(objNode, tvwChild, Text:=
"Test1-2"
)
Call
.Add(objNode, tvwChild, Text:=
"Test1-3"
)
Set
objNode = .Add(Text:=
"Test2"
)
Set
objNodeSub = .Add(objNode, tvwChild, Text:=
"Test2-1"
)
Call
.Add(objNodeSub, tvwChild, Text:=
"Test2-1-1"
)
Call
.Add(objNodeSub, tvwChild, Text:=
"Test2-1-2"
)
Set
objNode = .Add(Text:=
"Test3"
)
Call
.Add(objNode, tvwChild, Text:=
"Test3-1"
)
Call
.Add(objNode, tvwChild, Text:=
"Test3-2"
)
End
With
For
Each
objNode
In
.Nodes
objNode.Expanded =
True
Next
End
With
End
Sub