View Full Version : TreeView node images

07-07-2009, 02:45 AM
Hey guys!

I use WITH to add elements to a treeView object. Now I'd like to add pictures to some nodes but do not get a working result... Might just be a small referencing problem!? Below find the working code to add a node (top level)


Excel 2007, VBA
Userform with TreeView (MSCOMctl) -> "TreeView1"
ImageList -> "Ircon" with picture IDs 1-5

' Add node at last position

Function add_node(...) As Integer

With Me.TreeView1.Nodes

objTreeView1.ImageList = Me!Ircon.Object

Select Case node_type
'Add Node: Parent level
Case Is = 1
.Add Key:="Node" & Key, Text:=node_content
.Image = 1 'Not working (!!)
End Select

End With
End Function


Bob Phillips
07-07-2009, 03:20 AM
Can you post your workbook, with images and so on, to save us having to recreate it all?

07-07-2009, 04:01 AM
Certainly! Attached the workbook with some comments... So far it works but I did not succeed in adding icons to the nodes.